django fixtures code example
Example 1: create fixtures django
To dump data:
python manage.py dumpdata app.model_name --indent 4 > fixtures/file_name.json
To load data:
python manage.py loaddata fixtures/model_name.json --app app.model_name
Example 2: django manage.py dataload
./manage.py dumpdata notice.notice > notice.json --indent 4 --format json
Example 3: create fixtures django
python manage.py dumpdata app.model_name --indent 4 > fixtures/file_name.json
Example 4: initial data
form = MyForm(initial={'name': 'Peter'})