Skip to content

Instantly share code, notes, and snippets.

@rozza
Created October 13, 2010 09:10
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 rozza/623725 to your computer and use it in GitHub Desktop.
Save rozza/623725 to your computer and use it in GitHub Desktop.
An example of using fixtures in south migrations
from django.core import serializers
widgets = serializers.deserialize('json', open('widget/fixtures/widgets.json'))
for widget_data in widgets:
widget = orm.Widget()
for k,v in widget_data.object.__dict__.items():
if k.startswith('_'):
continue
setattr(widget, k, v)
widget.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment