April 2010

Django Dumpdata to Fixture for Initial Data

I always seem to forget this command and have to search the Django documentation to find it. Here's the command:

python manage.py dumpdata --indent=4 > initial_data.json

This will give you a nice .json file full of data from your database that looks similar to this one from the documentation.  You can specify a different file type like yaml or xml by add "--format=xml" as an argument.  The "--indent=4" makes the .json file easy on the eyes.  You can also specify a specific app or apps to dump data for by adding the app name or names after dumpdata command.  The way I have the command written will dump all data from all apps.

Now, if you delete your database and do a syncdb, the data from the .json file (or whatever type you chose) will be entered into the database right after the table creation.  This is useful for development if you are like me, and just delete the database and run syncdb to save time.  It is also useful when moving to a different database or to a production environment when you may need to preload the database with info.

The Project Owner, UI, and Graphics Flow Chart

This is subject to change but seems to be the best way to get a project done.

(click on the image to see the full version.)

UI-design_workflow revised