Skip to content

Instantly share code, notes, and snippets.

@chriskief

chriskief/forms.py

Created Oct 24, 2013
Embed
What would you like to do?
# the following fields can only be updated when the is_disabled property is set to false
def clean_field_1(self):
if self.instance.is_disabled:
return self.instance.field_1
else:
return self.cleaned_data.get('field_1')
def clean_field_2(self):
if self.instance.is_disabled:
return self.instance.field_2
else:
return self.cleaned_data.get('field_2')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment