Skip to content

Instantly share code, notes, and snippets.

@pygeek
Created May 7, 2013 18:57
Show Gist options
  • Save pygeek/5535148 to your computer and use it in GitHub Desktop.
Save pygeek/5535148 to your computer and use it in GitHub Desktop.
for local_field in self._meta.local_fields:
if isinstance(local_field, models.fields.files.FileField):
file_attr = getattr(prev_version, local_field.attname)
if file_attr:
file_ = File(file_attr)
setattr(self, local_field.attname, file_)
self.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment