mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Move selection field validation from admin form to model
This commit is contained in:
@ -89,14 +89,6 @@ class CustomFieldForm(forms.ModelForm):
|
||||
|
||||
order_content_types(self.fields['content_types'])
|
||||
|
||||
def clean(self):
|
||||
|
||||
# Validate selection choices
|
||||
if self.cleaned_data['type'] == CustomFieldTypeChoices.TYPE_SELECT and len(self.cleaned_data['choices']) < 2:
|
||||
raise forms.ValidationError({
|
||||
'choices': 'Selection fields must specify at least two choices.'
|
||||
})
|
||||
|
||||
|
||||
@admin.register(CustomField)
|
||||
class CustomFieldAdmin(admin.ModelAdmin):
|
||||
|
Reference in New Issue
Block a user