Feature Renew Op
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
| 892 | choices = kwargs.pop('choices') | |
| 893 | default = kwargs.pop('default') | |
| 894 | super(VmRenewForm, self).__init__(*args, **kwargs) | |
| 895 | ||
| 896 | self.fields['lease'] = forms.ModelChoiceField(queryset=choices, | |
| 897 | initial=default, | |
| 898 | required=True, | |
| 899 | label=_('Length')) | |
| 900 | if len(choices) < 2: | |
| 901 | self.fields['lease'].widget = HiddenInput() | |
| 902 | ||
| 903 | def clean_size(self): | |
| 904 | size_in_bytes = self.cleaned_data.get("size") | |
| 905 | if not size_in_bytes.isdigit() and len(size_in_bytes) > 0: | |
| 906 | raise forms.ValidationError(_("Invalid format, you can use " | |
| 907 | " GB or MB!")) | |
Please
register
or
sign in
to reply
|
||
| 88 | 95 | app_label = 'vm' |
| 89 | 96 | db_table = 'vm_lease' |
| 90 | 97 | ordering = ['name', ] |
| 98 | permissions = ( | |
| 99 | ('create_leases', _('Can create new leases.')), | |
| 100 | ('bypass_leases', _('Can set arbitrary expiration times.')), | |
|
||
<bd> kiváló