Skip to content

Instantly share code, notes, and snippets.

@chriskief
Created October 24, 2013 05:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chriskief/7131877 to your computer and use it in GitHub Desktop.
Save chriskief/7131877 to your computer and use it in GitHub Desktop.
# 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