Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fixed bug #2818 with another side of ForeignKey. Missed condition detail in a89b156 commit #1519

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants

iorlas commented Aug 27, 2013

As we can see, in https://code.djangoproject.com/ticket/2818 we have fixed bug in django admin behavior with joins - we should use distinct in this cases. Commit 4938c8e fixed this issue.
But, in a89b156 it was reworked as set of codelines for enhanced conditions. To check for possible joins, was created function lookup_needs_distinct. It looks for field by name(for example, in 'user__docs__name' it takes 'user') and does some checks to verify is it relation object.
As we can see, RelatedObject(any relation) and ManyToManyRel(reverse side of ManyToMany) handled. But, we also have reverse side of ForeignKey - ManyToOneRel. So yea, we have a problem here - appearance of bug #2818. So I decide to create this pull request. At least, it works perfectly for me.
FYI, I'm not checking for OneToOneRel, because there should be no duplications in this case.

iorlas commented Aug 27, 2013

By the way, no matter how I tried, I cannot login in to traq. Evey time it says "Please correct the errors below:" and this is it. I've reset password 10 times, set it, but still cannot login.

Owner

timgraham commented Aug 28, 2013

How are you trying to log in to trac? "Login" button on https://code.djangoproject.com/timeline ?

This will also need a test in order to be merged.

iorlas commented Aug 28, 2013

I've tried to use both "ways". But now it works with your link. So I'll create a ticket now.
Here we go: https://code.djangoproject.com/ticket/20991

Owner

timgraham commented Aug 28, 2013

Great, however, upon further investigation, I don't think this is the best fix -- see my comment on the ticket. Thanks!

@timgraham timgraham closed this Aug 28, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment