How to create a fixture file
Read “Providing initial data for models”.
- Load some data into a Django-managed database. Simple Python scripts work nicely, Or use the default admin interface.
- Use
manage.py dumpdata
to dump the data into a JSON fixture file. Read "django-admin.py and manage.py".
You must create a directory in your app named fixtures and put your fixtures files there.
You can write them in json or xml, one easy way to make them is to create some objects in the admin interface and then run manage.py dumpdata. That would dump the data from the objects you created into fixture files. After that you could simply edit those files to suit them to your needs.
https://docs.djangoproject.com/en/1.7/ref/django-admin/#dumpdata-app-label-app-label-app-label-model
If you want to load the fixtures you use manage.py loaddata.
https://docs.djangoproject.com/en/1.7/ref/django-admin/#loaddata-fixture-fixture
You can have fixtures with initial data that would be automatically loaded when you run syncdb, just create a file named initial_data and Django would recognize it.
To use fixtures for testing purposes you must declare them in your test class
https://docs.djangoproject.com/en/1.7/topics/testing/tools/#fixture-loading