in my project someone accidentally added a default fixture dir to the
FIXTURE_DIRS, and it took us a while to figure out why things were
imported twice.
on a side node, if fixtures of the same name are in different directories,
there are all imported, as opposed to when they are in the same directory
(with different extensions). is this intended?
--
Ticket URL: <https://code.djangoproject.com/ticket/23468>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_docs: => 0
* needs_better_patch: => 0
* component: Uncategorized => Core (Management commands)
* needs_tests: => 0
* stage: Unreviewed => Accepted
Comment:
In this situation, Django could raise an `ImproperlyConfigured` exception,
emit a warning (maybe with a check?), or at least deduplicate the list.
Loading the fixture twice doesn't make sense.
Regarding your second question, yes, this is the intended behavior.
--
Ticket URL: <https://code.djangoproject.com/ticket/23468#comment:1>
* status: new => assigned
* owner: nobody => kswiat
--
Ticket URL: <https://code.djangoproject.com/ticket/23468#comment:2>
* needs_better_patch: 0 => 1
* has_patch: 0 => 1
Comment:
Work in progress:
https://github.com/kswiat/django/commit/0b96027f697c173f860be2cef18451a715dbe7f1
But I will probably move it to the check framework, because apps are not
ready at this point (loading settings). Apps need to be registered in
order to get their labels (correct me if I'm wrong and there is other
clean way to do it).
--
Ticket URL: <https://code.djangoproject.com/ticket/23468#comment:3>
* needs_tests: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/23468#comment:4>
* needs_better_patch: 1 => 0
* needs_tests: 1 => 0
Comment:
Pull request ready.
--
Ticket URL: <https://code.djangoproject.com/ticket/23468#comment:5>
Comment (by claudep):
Wouldn't it be better to check this in the loaddata `fixture_dirs` method?
--
Ticket URL: <https://code.djangoproject.com/ticket/23468#comment:6>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/23468#comment:7>
* cc: konrad.swiat@… (added)
Comment:
There is new PR with different approach, that checks settings.FIXTURE_DIRS
in the loaddata fixture_dirs method. If there are duplications or default
fixture dir of an app, exception is raised.
https://github.com/django/django/pull/3447
Or maybe it should emit a warning instead of raising?
--
Ticket URL: <https://code.djangoproject.com/ticket/23468#comment:8>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/23468#comment:9>
* needs_better_patch: 0 => 1
* needs_docs: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/23468#comment:10>
* needs_better_patch: 1 => 0
* needs_docs: 1 => 0
Comment:
I added release notes for 1.7.2, 1.8 and improved patch.
--
Ticket URL: <https://code.djangoproject.com/ticket/23468#comment:11>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"934a16dc93a5f46f965ba299dbd543703d32d493"]:
{{{
#!CommitTicketReference repository=""
revision="934a16dc93a5f46f965ba299dbd543703d32d493"
Fixed #23468 -- Added checks for duplicate fixtures directories in
loaddata.
If settings.FIXTURE_DIRS contains duplicates or a default fixture
directory (app_name/fixtures), ImproperlyConfigured is raised.
Thanks to Berker Peksag and Tim Graham for review.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23468#comment:12>