mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
* Disallow changing customfield type after creation * Fix test_api.CustomFieldTest --------- Co-authored-by: kkthxbye-code <>
This commit is contained in:
@@ -64,6 +64,13 @@ class CustomFieldForm(BootstrapMixin, forms.ModelForm):
|
||||
'ui_visibility': StaticSelect(),
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
# Disable changing the type of a CustomField as it almost universally causes errors if custom field data is already present.
|
||||
if self.instance.pk:
|
||||
self.fields['type'].disabled = True
|
||||
|
||||
|
||||
class CustomLinkForm(BootstrapMixin, forms.ModelForm):
|
||||
content_types = ContentTypeMultipleChoiceField(
|
||||
|
Reference in New Issue
Block a user