0

Is there a way to have fixtures in raw Python to, for example, create initial data from external files? I have fixtures in JSON presently, and it might actually be more effective to migrate them to a kind of CSV file and have Python parse these and insert them. Is there a way to do this in Django?

Naftuli Kay
  • 87,710
  • 93
  • 269
  • 411

2 Answers2

1

I just released library for exactly this purposes https://pypi.python.org/pypi/django_pyfixture/

You'll get manage.py loaddata_py <fixturename> for console API and py_fixtures = [<list of fixtures>] for your tests.

https://pypi.python.org/pypi/django_pyfixture/

Konstantine Rybnikov
  • 2,457
  • 1
  • 22
  • 29
1

Catch the post_syncdb signal and do your work in the handler.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358