[Django] #27356: admin lookup_allowed returns False for a filter which is in list_filter

37 views
Skip to first unread message

Django

unread,
Oct 17, 2016, 11:49:40 AM10/17/16
to django-...@googlegroups.com
#27356: admin lookup_allowed returns False for a filter which is in list_filter
-------------------------------+--------------------
Reporter: Tobias Krönke | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.10
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Assume these 3 models in an app called `foo`:

{{{#!python
class Somebody(models.Model):
user = models.OneToOneField(AUTH_USER_MODEL)

class Profile(models.Model): # we want an admin for this and filter on
related data!
who = models.OneToOneField(Somebody)

class ClientInfo(models.Model):
who = models.OneToOneField(Somebody)
filter_by_me_please = models.CharField(db_index=True, max_length=20,
blank=True)
}}}

and this profile admin:

{{{#!python
class ProfileAdmin(admin.ModelAdmin):
list_filter = ('who__clientinfo__filter_by_me_please', )

admin.site.register(Profile, ProfileAdmin)
}}}

I get this error
{{{
DisallowedModelAdminLookup at /admin/foo/profile/
Filtering by who__clientinfo__filter_by_me_please not allowed
}}}
on opening
http://localhost:8000/admin/foo/profile/?who__clientinfo__filter_by_me_please=yay

The 3 lookup levels seem to be important to reproduce this.

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

Django

unread,
Oct 17, 2016, 3:00:43 PM10/17/16
to django-...@googlegroups.com
#27356: admin lookup_allowed incorrectly returns False for a nested reverse
OneToOneField
-------------------------------+------------------------------------

Reporter: Tobias Krönke | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.10
Severity: Normal | 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 Tim Graham):

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


Comment:

Reproduced at a4e9e834e3dfc8d5a024a78c765f193105d41a48.

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

Django

unread,
Oct 17, 2016, 3:59:55 PM10/17/16
to django-...@googlegroups.com
#27356: admin lookup_allowed incorrectly returns False for a nested reverse
OneToOneField
-------------------------------+------------------------------------
Reporter: Tobias Krönke | Owner: felixxm
Type: Bug | Status: assigned
Component: contrib.admin | Version: 1.10

Severity: Normal | 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 felixxm):

* owner: nobody => felixxm
* status: new => assigned


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

Django

unread,
Oct 18, 2016, 2:43:25 AM10/18/16
to django-...@googlegroups.com
#27356: admin lookup_allowed incorrectly returns False for a nested reverse
OneToOneField
-------------------------------+------------------------------------
Reporter: Tobias Krönke | Owner: felixxm
Type: Bug | Status: assigned
Component: contrib.admin | Version: 1.10

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/7406 PR]

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

Django

unread,
Nov 5, 2016, 8:33:16 AM11/5/16
to django-...@googlegroups.com
#27356: admin lookup_allowed incorrectly returns False for a nested reverse
OneToOneField
-------------------------------+------------------------------------------
Reporter: Tobias Krönke | Owner: Tobias McNulty
Type: Bug | Status: assigned
Component: contrib.admin | Version: 1.10

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* owner: felixxm => Tobias McNulty


Comment:

Reviewing at DUTH sprint.

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

Django

unread,
Nov 5, 2016, 11:21:16 AM11/5/16
to django-...@googlegroups.com
#27356: admin lookup_allowed incorrectly returns False for a nested reverse
OneToOneField
-------------------------------+------------------------------------
Reporter: Tobias Krönke | Owner: (none)

Type: Bug | Status: new
Component: contrib.admin | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* owner: Tobias McNulty => (none)
* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/27356#comment:5>

Django

unread,
Nov 5, 2016, 3:12:29 PM11/5/16
to django-...@googlegroups.com
#27356: admin lookup_allowed incorrectly returns False for a nested reverse
OneToOneField
-------------------------------+------------------------------------
Reporter: Tobias Krönke | Owner: felixxm
Type: Bug | Status: assigned
Component: contrib.admin | Version: 1.10

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

* owner: (none) => felixxm
* needs_better_patch: 0 => 1


* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/27356#comment:6>

Django

unread,
Nov 5, 2016, 3:50:50 PM11/5/16
to django-...@googlegroups.com
#27356: admin lookup_allowed incorrectly returns False for a nested reverse
OneToOneField
-------------------------------+------------------------------------
Reporter: Tobias Krönke | Owner: felixxm
Type: Bug | Status: assigned
Component: contrib.admin | Version: 1.10

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/27356#comment:7>

Django

unread,
Nov 23, 2016, 8:51:44 AM11/23/16
to django-...@googlegroups.com
#27356: admin lookup_allowed incorrectly returns False for a nested reverse
OneToOneField
-------------------------------+------------------------------------
Reporter: Tobias Krönke | Owner: felixxm
Type: Bug | Status: assigned
Component: contrib.admin | Version: 1.10

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/27356#comment:8>

Django

unread,
Dec 30, 2016, 11:32:21 AM12/30/16
to django-...@googlegroups.com
#27356: admin lookup_allowed incorrectly returns False for a nested reverse
OneToOneField
-------------------------------+------------------------------------
Reporter: Tobias Krönke | Owner: (none)

Type: Bug | Status: new
Component: contrib.admin | Version: 1.10
Severity: Normal | 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 felixxm):

* status: assigned => new
* owner: felixxm => (none)
* has_patch: 1 => 0


* needs_better_patch: 1 => 0


Comment:

I don't have idea how to fix this without breaking
`admin_views.tests.AdminViewBasicTest.test_disallowed_filtering`.

--
Ticket URL: <https://code.djangoproject.com/ticket/27356#comment:9>

Django

unread,
Jan 4, 2017, 2:06:31 PM1/4/17
to django-...@googlegroups.com
#27356: admin lookup_allowed incorrectly returns False for a nested reverse
OneToOneField
-------------------------------+------------------------------------
Reporter: Tobias Krönke | Owner: (none)
Type: Bug | Status: new
Component: contrib.admin | Version: 1.10
Severity: Normal | 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 Anton Samarchyan):

* Attachment "djtest.zip" added.

Django

unread,
Jan 4, 2017, 2:07:16 PM1/4/17
to django-...@googlegroups.com
#27356: admin lookup_allowed incorrectly returns False for a nested reverse
OneToOneField
-------------------------------+------------------------------------
Reporter: Tobias Krönke | Owner: (none)
Type: Bug | Status: new
Component: contrib.admin | Version: master

Severity: Normal | 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 Anton Samarchyan):

* cc: desecho@… (added)
* version: 1.10 => master


Comment:

I added a project to easily reproduce a problem. Admin credentials -
admin/iaN4viph8653 .

--
Ticket URL: <https://code.djangoproject.com/ticket/27356#comment:10>

Django

unread,
Jan 4, 2017, 2:35:00 PM1/4/17
to django-...@googlegroups.com
#27356: admin lookup_allowed incorrectly returns False for a nested reverse
OneToOneField
-------------------------------+------------------------------------
Reporter: Tobias Krönke | Owner: (none)
Type: Bug | Status: new

Component: contrib.admin | Version: master
Severity: Normal | 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 Anton Samarchyan):

* Attachment "djtest.zip" added.

Django

unread,
Jan 4, 2017, 6:40:53 PM1/4/17
to django-...@googlegroups.com
#27356: admin lookup_allowed incorrectly returns False for a nested reverse
OneToOneField
-------------------------------+------------------------------------
Reporter: Tobias Krönke | Owner: (none)
Type: Bug | Status: new

Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* has_patch: 0 => 1


Comment:

I added a [https://github.com/django/django/pull/7792 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/27356#comment:11>

Django

unread,
Feb 7, 2017, 7:43:53 PM2/7/17
to django-...@googlegroups.com
#27356: admin lookup_allowed incorrectly returns False for a nested reverse
OneToOneField
-------------------------------------+-------------------------------------
Reporter: Tobias Krönke | Owner: Tim
| Graham <timograham@…>
Type: Bug | Status: closed
Component: contrib.admin | Version: master
Severity: Normal | Resolution: fixed

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

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* owner: (none) => Tim Graham <timograham@…>
* resolution: => fixed


Comment:

In [changeset:"b27166b7690fbe5d695b828361a74699ddd2678a" b27166b]:
{{{
#!CommitTicketReference repository=""
revision="b27166b7690fbe5d695b828361a74699ddd2678a"
Fixed #27356 -- Fixed ModelAdmin.lookup_allowed() for some nested
relations.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27356#comment:12>

Reply all
Reply to author
Forward
0 new messages