loaddata and processing order of fixtures
|Reported by:||Luc Saffre||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||yes|
As the documentation for loaddata correctly says: "the order in which fixture files are processed is undefined."
That's a pity because I use fixtures to provide combinable and interdependent sets of demo data.
Would it be difficult to implement a rule for the order in which fixtures are loaded?
I'd suggest the following rule:
If there are 3 applications "a", "b" and "c" and you invoke
manage.py loaddata foo bar baz
(or you specify
fixtures = ['foo','bar','baz']
in a TestCase, then loaddata would first load all fixtures 'foo' for all applications, then all fixtures named 'bar', then all fixtures 'baz'.
Change History (9)
comment:3 Changed 6 years ago by
|Component:||Uncategorized → Core (Management commands)|
|Triage Stage:||Unreviewed → Design decision needed|
|Type:||New feature → Cleanup/optimization|
comment:4 Changed 6 years ago by
|Component:||Core (Management commands) → Documentation|
|Triage Stage:||Design decision needed → Accepted|