Commit 52a7dc2a by Kálmán Viktor

dashboard: better amount validation

parent 2e041956
...@@ -116,7 +116,7 @@ class VmCustomizeForm(forms.Form): ...@@ -116,7 +116,7 @@ class VmCustomizeForm(forms.Form):
'min': "1", 'min': "1",
'style': "max-width: 60px", 'style': "max-width: 60px",
'required': "", 'required': "",
}), initial=1) }), initial=1, min_value=1)
disks = forms.ModelMultipleChoiceField( disks = forms.ModelMultipleChoiceField(
queryset=None, required=False, queryset=None, required=False,
...@@ -136,12 +136,6 @@ class VmCustomizeForm(forms.Form): ...@@ -136,12 +136,6 @@ class VmCustomizeForm(forms.Form):
template = forms.CharField(widget=forms.HiddenInput()) template = forms.CharField(widget=forms.HiddenInput())
customized = forms.CharField(widget=forms.HiddenInput()) customized = forms.CharField(widget=forms.HiddenInput())
def clean_amount(self):
data = self.cleaned_data['amount']
if data < 1:
data = 1
return data
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.user = kwargs.pop("user", None) self.user = kwargs.pop("user", None)
self.template = kwargs.pop("template", None) self.template = kwargs.pop("template", None)
......
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