2👍
✅
Change your form for it:
class SettingsForm(forms.ModelForm):
class Meta:
model = Settings
def __init__(self, *args, **kwargs):
super(SettingsForm, self).__init__(*args, **kwargs)
def clean(self):
cleaned_data = super(SettingsForm, self).clean()
field_1 = cleaned_data.get('field_1','')
if not field_1: # field_2 is disabled
cleaned_data['field_2'] = self.instance.field_2 # so get from db
self.cleaned_data = cleaned_data
return self.cleaned_data
👤Goin
Source:stackexchange.com