loaddata and processing order of fixtures
|Reported by:||lsaffre||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 5 years ago by jacob
- Component changed from Uncategorized to Core (Management commands)
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Design decision needed
- Type changed from New feature to Cleanup/optimization
comment:4 Changed 5 years ago by russellm
- Component changed from Core (Management commands) to Documentation
- Triage Stage changed from Design decision needed to Accepted