Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create prettier fixtures with manage.py dumpdata?

Tags:

I'm trying to get my Django fixtures printed in a prettier way.

I've outputting the fixtures:
python manage.py dumpdata >> fixture_app.json

This creates a file with 1000's of characters all on one line. When I try to view the file with my Text Editor( TextMate ), the Editor hangs.

Is there anyway that the fixtures can be exported in a prettier way using multiple lines?

like image 727
BryanWheelock Avatar asked Mar 18 '10 14:03

BryanWheelock


People also ask

How do I use fixtures in Django?

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.

What is Admin py in Django?

The admin.py file is used to display your models in the Django admin panel. You can also customize your admin panel.


1 Answers

You can try:

python manage.py dumpdata --indent=2 

it will be easier to read.

like image 155
Olivier Verdier Avatar answered Oct 31 '22 21:10

Olivier Verdier