[Django] #21431: Django 1.6 GenericRelation admin list_filter regression

17 views
Skip to first unread message

Django

unread,
Nov 13, 2013, 2:54:05 AM11/13/13
to django-...@googlegroups.com
#21431: Django 1.6 GenericRelation admin list_filter regression
---------------------------------+--------------------
Reporter: stephenmcd | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.6
Severity: Release blocker | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------
Previously in 1.5 it was possible to have a model A with a GenericRelation
field to a model B that had a ForeignKey to model C, and use the B__C path
in A's admin list_filter.

In 1.6 this fails in django.contrib.admin.util.get_model_from_relation
where the model on the wrong side of the relationship is returned, when
the correct model is available via the parent_model attribute.

I've created a fix and test case here:
https://github.com/django/django/pull/1913

Although as discussed, the fix should probably be different.

--
Ticket URL: <https://code.djangoproject.com/ticket/21431>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 14, 2013, 12:50:17 PM11/14/13
to django-...@googlegroups.com
#21431: Django 1.6 GenericRelation admin list_filter regression
---------------------------------+------------------------------------

Reporter: stephenmcd | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.6
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by akaariai):

* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted


Comment:

A proposed patch for 1.6.x in
https://github.com/akaariai/django/commit/c895dd39ae4e7687b57ff01ecfcc27caf70323ed.

There are two issues I am concerned with:
- Is the tests in the correct place, and are the inline models the
correct way forward?
- Is there more similar regressions in admin? The get_field_by_name()
method is used a lot for constructing relations, path names etc. Maybe
some of those are affected too.

In general the admin code should be DRYed up a little when it comes to
relation path generation.

For master the elif branches in admin/util.py could be removed, it
shouldn't be hit at all, but for 1.6 could cause more regressions
(shouldn't, but can't assert it doesn't).

--
Ticket URL: <https://code.djangoproject.com/ticket/21431#comment:1>

Django

unread,
Nov 20, 2013, 6:11:13 PM11/20/13
to django-...@googlegroups.com
#21431: Django 1.6 GenericRelation admin list_filter regression
---------------------------------+------------------------------------

Reporter: stephenmcd | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.6
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by stephenmcd):

Thanks akaariai - I can confirm the above path resolves the issue in
Mezzanine.

--
Ticket URL: <https://code.djangoproject.com/ticket/21431#comment:2>

Django

unread,
Nov 21, 2013, 8:02:44 AM11/21/13
to django-...@googlegroups.com
#21431: Django 1.6 GenericRelation admin list_filter regression
---------------------------------+------------------------------------
Reporter: stephenmcd | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.6
Severity: Release blocker | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by Anssi Kääriäinen <akaariai@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"752d3d70da6291039f33781a0a2ef6f3b7c5fcb5"]:
{{{
#!CommitTicketReference repository=""
revision="752d3d70da6291039f33781a0a2ef6f3b7c5fcb5"
Fixed #21431 -- GenRel->FK list_filter regression in admin

Report, analysis and tests from stephenmcd.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21431#comment:3>

Django

unread,
Nov 21, 2013, 8:34:38 AM11/21/13
to django-...@googlegroups.com
#21431: Django 1.6 GenericRelation admin list_filter regression
---------------------------------+------------------------------------
Reporter: stephenmcd | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.6

Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by Anssi Kääriäinen <akaariai@…>):

In [changeset:"5730bf281922151f211a2509dd8b493230d6a187"]:
{{{
#!CommitTicketReference repository=""
revision="5730bf281922151f211a2509dd8b493230d6a187"
[1.6.x] Fixed #21431 -- GenRel->FK list_filter regression in admin

Report, analysis and tests from stephenmcd.

Backpatch of 752d3d70da6291039f33781a0a2ef6f3b7c5fcb5 from master.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21431#comment:4>

Reply all
Reply to author
Forward
0 new messages