Skip to content

Instantly share code, notes, and snippets.

@qpfiffer
Created January 4, 2017 19:07
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 qpfiffer/53f744e2b32ad4d238ba577cbecfbfb7 to your computer and use it in GitHub Desktop.
Save qpfiffer/53f744e2b32ad4d238ba577cbecfbfb7 to your computer and use it in GitHub Desktop.
for field in changed_bar_fields_whitelist:
formatted_field_name = '_stashed_{}'.format(field)
try:
stashed_field = getattr(instance, formatted_field_name)
current_field = getattr(instance, field)
if current_field != stashed_field:
changed.append(field)
except AttributeError:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment