Question

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?

Was it helpful?

Solution

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

OTHER TIPS

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/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top