views:

51

answers:

2

Is there anyway to load one fixture and have it load multiple fixtures?

I'd ideally like to type:

python manage.py loaddata all_fixtures

And have that load all of the data instead of having to type everything. Is this possible?

+1  A: 

Using $ python manage.py loaddata myfixtures/*.json would work as Bash will substitute the wildcard to a list of matching filenames.

speakman
+2  A: 

Why not create a Makefile that pulls in all your fixtures? eg something like:

load_all_fixtures: 
    ./manage.py loaddata path/to/fixtures/foo.json
    ./manage.py loaddata path/to/fixtures/bar.json
    ./manage.py loaddata path/to/fixtures/baz.json

And then at the shell prompt, run

make load_all_fixtures

(This kind of approach is also good for executing unit tests for certain apps only and ignoring others, if need be)

stevejalim