Skip to content

Instantly share code, notes, and snippets.

@yegle
Created January 21, 2013 00:29
Show Gist options
  • Save yegle/4582809 to your computer and use it in GitHub Desktop.
Save yegle/4582809 to your computer and use it in GitHub Desktop.
How to use Django's get_readonly_fields
def get_readonly_fields(self, request, obj=None):
if obj and obj.is_processed:
return ('csv_file',) + self.readonly_fields
else:
return self.readonly_fields
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment