--
Ticket URL: <https://code.djangoproject.com/ticket/16609>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: cheater00@… (added)
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/16609#comment:1>
Comment (by cheater <cheater00@…>):
Sorry about not using code blocks above - only noticed the error after
submitting the ticket. The search_fields should look like this:
{{{
search_fields = ['=id', '=fkmodel__m2mmodel__name']
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/16609#comment:2>
--
Comment (by aaugustin):
Fixed formatting.
--
Ticket URL: <https://code.djangoproject.com/ticket/16609#comment:3>
--
--
Ticket URL: <https://code.djangoproject.com/ticket/16609#comment:4>
* stage: Unreviewed => Accepted
Comment:
It's likely that this is an ORM bug, but since the symptoms show in the
admin, I'll leave it like this until we have more information.
--
Ticket URL: <https://code.djangoproject.com/ticket/16609#comment:5>
Comment (by cheater <cheater00@…>):
For one thing, the admin actions also get doubled items. In fact, it is so
that this could lead to fairly serious data loss and other errors. Imagine
an admin action which bills users for something - they get found twice -
and they get billed twice! I think this warrants bumping up the
importance. I have also stumbled upon this when I was writing a money-
related summary which counted the amount of items in stock, and summarized
them, also calculating the prices. The prices were way off, of course. I
have done a workaround wich skips objects that have already been seen by
tracking the ID, but some other people might not be so lucky as to notice
the problem before it's too late.
--
Ticket URL: <https://code.djangoproject.com/ticket/16609#comment:6>
Comment (by andreas@…):
Has this bug been fixed in later versions of django? Still broken in 1.3.
--
Ticket URL: <https://code.djangoproject.com/ticket/16609#comment:7>
* cc: CodenameTim (added)
Comment:
This bug has been fixed by at least 1.3.7 and it's fixed in master.
--
Ticket URL: <https://code.djangoproject.com/ticket/16609#comment:8>
* status: new => closed
* resolution: => fixed
--
Ticket URL: <https://code.djangoproject.com/ticket/16609#comment:9>
Comment (by sampaccoud):
I came across this bug which does not seem to be totally fixed yet? I
tried to propose a fix and submitted a PR:
https://github.com/django/django/pull/4504
--
Ticket URL: <https://code.djangoproject.com/ticket/16609#comment:10>
* status: closed => new
* resolution: fixed =>
--
Ticket URL: <https://code.djangoproject.com/ticket/16609#comment:11>
* has_patch: 0 => 1
Comment:
I wonder if we might mark this as a duplicate of #15819. The proposed
patch there removes `lookup_needs_distinct()` instead of making it more
complicated and looks like it would fix other issues.
--
Ticket URL: <https://code.djangoproject.com/ticket/16609#comment:12>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/16609#comment:13>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"d084176cc1273d5faf6f88eedb4c490e961f3a68" d084176c]:
{{{
#!CommitTicketReference repository=""
revision="d084176cc1273d5faf6f88eedb4c490e961f3a68"
Fixed #16609 -- Fixed duplicate admin results when searching nested M2M
relations.
This was fixed earlier but only when the M2M relation was at the first
level on the object. This commit fixes the issue even when the M2M is
at deeper levels, such as behind a foreign key.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/16609#comment:14>