Commit 9977cf86 by Őry Máté

dashboard: use queryset for renew choices

fixes #196
parent 409e0069
...@@ -836,7 +836,7 @@ class VmRenewView(FormOperationMixin, TokenOperationView, VmOperationView): ...@@ -836,7 +836,7 @@ class VmRenewView(FormOperationMixin, TokenOperationView, VmOperationView):
choices = Lease.get_objects_with_level("user", self.request.user) choices = Lease.get_objects_with_level("user", self.request.user)
default = self.get_op().instance.lease default = self.get_op().instance.lease
if default and default not in choices: if default and default not in choices:
choices = list(choices) + [default] choices = choices | Lease.objects.filter(pk=default.pk).distinct()
val = super(VmRenewView, self).get_form_kwargs() val = super(VmRenewView, self).get_form_kwargs()
val.update({'choices': choices, 'default': default}) val.update({'choices': choices, 'default': default})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment