Commit e39cd3f8 by Őry Máté

dashboard: fix deploy view/form

parent ac20a85d
...@@ -910,7 +910,7 @@ class VmAddInterfaceForm(OperationForm): ...@@ -910,7 +910,7 @@ class VmAddInterfaceForm(OperationForm):
self.fields['vlan'] = field self.fields['vlan'] = field
class VmDeployForm(forms.Form): class VmDeployForm(OperationForm):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
choices = kwargs.pop('choices', None) choices = kwargs.pop('choices', None)
...@@ -919,7 +919,7 @@ class VmDeployForm(forms.Form): ...@@ -919,7 +919,7 @@ class VmDeployForm(forms.Form):
if choices is not None: if choices is not None:
self.fields.insert(0, 'node', forms.ModelChoiceField( self.fields.insert(0, 'node', forms.ModelChoiceField(
queryset=choices, label=_('Node'), help_text=_( queryset=choices, required=False, label=_('Node'), help_text=_(
"Deploy virtual machine to this node " "Deploy virtual machine to this node "
"(blank allows scheduling automatically)."))) "(blank allows scheduling automatically).")))
......
...@@ -634,7 +634,7 @@ class VmDeployView(FormOperationMixin, VmOperationView): ...@@ -634,7 +634,7 @@ class VmDeployView(FormOperationMixin, VmOperationView):
form_class = VmDeployForm form_class = VmDeployForm
def get_form_kwargs(self): def get_form_kwargs(self):
kwargs = super(VmOperationView, self).get_form_kwargs() kwargs = super(VmDeployView, self).get_form_kwargs()
if self.request.user.is_superuser: if self.request.user.is_superuser:
online = (n.pk for n in online = (n.pk for n in
Node.objects.filter(enabled=True) if n.online) Node.objects.filter(enabled=True) if n.online)
......
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