mirror of
https://github.com/netbox-community/netbox.git
synced 2026-02-06 07:16:25 -06:00
#9073: Fix form behavior when disassociating a ConfigContext from a DataFile
This commit is contained in:
@@ -267,6 +267,14 @@ class ConfigContextForm(BootstrapMixin, SyncedDataMixin, forms.ModelForm):
|
||||
'tenants', 'tags', 'data_source', 'data_file',
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
# Disable data field when a DataFile has been set
|
||||
if self.instance.data_file:
|
||||
self.fields['data'].widget.attrs['readonly'] = True
|
||||
self.fields['data'].help_text = _('Data is populated from the remote source selected below.')
|
||||
|
||||
def clean(self):
|
||||
super().clean()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user