DJango fixtures

One of the important feature from DJango is fixture generation and consumption.

Fixture is nothing but searialized data in file with proper file naming. Well, it by default recognizes some serialization formats. ex: xml, json etc. Usally file names goes like this: MyFixture.json.

DJango tries to learn data format from file extension.
Generating fixtures from DJango is pretty easy

manage.py dumpdata

Above command results serialized data of all models of your all apps under project. Ofcourse, there are couple of options to fine tune your command to exclude some apps, to mention format of serialization etc.

manage.py help dumpdata

issue above command to get full details of available options from your DJango project path.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s