Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
abfafd7a
authored
7 years ago
by
Szabolcs Gelencser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show permitted leases only on renew dialog
parent
d9ff14e6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletions
+8
-1
circle/dashboard/views/vm.py
+8
-1
No files found.
circle/dashboard/views/vm.py
View file @
abfafd7a
...
@@ -724,8 +724,15 @@ class VmRenewView(FormOperationMixin, VmOperationView):
...
@@ -724,8 +724,15 @@ class VmRenewView(FormOperationMixin, VmOperationView):
template_name
=
'dashboard/_vm-renew.html'
template_name
=
'dashboard/_vm-renew.html'
def
get_form_kwargs
(
self
):
def
get_form_kwargs
(
self
):
choices
=
Lease
.
objects
.
all
()
#TODO: filter on permissions
instance
=
self
.
get_op
()
.
instance
instance
=
self
.
get_op
()
.
instance
user_role_names
=
[
role
[
"name"
]
for
role
in
self
.
request
.
user
.
roles
]
leases_from_roles
=
Lease
.
objects
.
filter
(
roles_permitted__role_name__in
=
user_role_names
)
default_lease
=
Lease
.
objects
.
filter
(
name
=
settings
.
DEFAULT_LEASE_NAME
)
current_lease
=
Lease
.
objects
.
filter
(
vmlease__os_server_id
=
instance
.
id
)
choices
=
(
leases_from_roles
|
default_lease
|
current_lease
)
.
distinct
()
default
=
VmLease
.
objects
.
get
(
os_server_id
=
instance
.
id
)
.
lease
default
=
VmLease
.
objects
.
get
(
os_server_id
=
instance
.
id
)
.
lease
# if default and default not in choices:
# if default and default not in choices:
# choices = (choices.distinct() |
# choices = (choices.distinct() |
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment