[Django] #22792: Check rule for list_display_links is incorrect

151 views
Skip to first unread message

Django

unread,
Jun 8, 2014, 1:53:33 AM6/8/14
to django-...@googlegroups.com
#22792: Check rule for list_display_links is incorrect
-------------------------------+------------------------
Reporter: bendavis78 | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.7-beta-2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+------------------------
This use case should be allowed according to the documentation:

{{{
#!python
@admin.register(products.Product)
class ModelAdmin(admin.ModelAdmin):
list_display = ['brand', 'product', 'category']
list_editable = list_display
list_display_links = None
}}}

However, checks will fail saying:

<class 'products.admin.ProductAdmin'>: (admin.E124) The value of
'list_editable[0]' refers to the first field in 'list_display' ('brand'),
which cannot be used unless 'list_display_links' is set.

I think this check is a mistake. What it should be checking for is this:
If the first values of `list_editable` and `list_display` are the same,
list_display_links must be either set to None, or must be set to a field
other than the first field in `list_display`.

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

Django

unread,
Jun 9, 2014, 1:58:29 PM6/9/14
to django-...@googlegroups.com
#22792: Check rule for list_display_links is incorrect
---------------------------------+--------------------------------------

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

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

* needs_better_patch: => 0
* needs_docs: => 0
* severity: Normal => Release blocker
* needs_tests: => 0
* stage: Unreviewed => Accepted


Comment:

Another issue we should also fix is in the previous check `admin.E123` --
it should be `elif cls.list_display_links and field_name in
cls.list_display_links` so that if `list_display_links` is `None` there
isn't a `TypeError: argument of type 'NoneType' is not iterable` error.

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

Django

unread,
Jun 10, 2014, 3:51:08 AM6/10/14
to django-...@googlegroups.com
#22792: Check rule for list_display_links is incorrect
---------------------------------+--------------------------------------
Reporter: bendavis78 | Owner: gchp
Type: Bug | Status: assigned
Component: contrib.admin | Version: 1.7-beta-2

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

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

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


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

Django

unread,
Jun 10, 2014, 7:02:40 AM6/10/14
to django-...@googlegroups.com
#22792: Check rule for list_display_links is incorrect
---------------------------------+--------------------------------------
Reporter: bendavis78 | Owner: gchp
Type: Bug | Status: assigned
Component: contrib.admin | Version: 1.7-beta-2

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

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

* has_patch: 0 => 1


Comment:

Created a PR here: https://github.com/django/django/pull/2786

The use case given above now works, and `admin.E123` has also been fixed.

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

Django

unread,
Jun 10, 2014, 9:36:20 AM6/10/14
to django-...@googlegroups.com
#22792: Check rule for list_display_links is incorrect
---------------------------------+--------------------------------------
Reporter: bendavis78 | Owner: gchp
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.7-beta-2
Severity: Release blocker | Resolution: fixed

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

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

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


Comment:

In [changeset:"d8f19bb3b6f858bef499fdab41948a5a5e8d55aa"]:
{{{
#!CommitTicketReference repository=""
revision="d8f19bb3b6f858bef499fdab41948a5a5e8d55aa"
Fixed #22792 -- Updated checks for list_display_links in model admin
}}}

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

Django

unread,
Jun 10, 2014, 9:43:56 AM6/10/14
to django-...@googlegroups.com
#22792: Check rule for list_display_links is incorrect
---------------------------------+--------------------------------------
Reporter: bendavis78 | Owner: gchp
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.7-beta-2

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

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

Comment (by Tim Graham <timograham@…>):

In [changeset:"d232a5f93f2c0be93b6aa5669e9cba0f328a4a9b"]:
{{{
#!CommitTicketReference repository=""
revision="d232a5f93f2c0be93b6aa5669e9cba0f328a4a9b"
[1.7.x] Fixed #22792 -- Updated checks for list_display_links in model
admin

Backport of d8f19bb3b6 from master
}}}

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

Django

unread,
Mar 1, 2016, 8:21:24 AM3/1/16
to django-...@googlegroups.com
#22792: Check rule for list_display_links is incorrect
---------------------------------+--------------------------------------
Reporter: bendavis78 | Owner: gchp
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.7-beta-2

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

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

Comment (by Tim Graham <timograham@…>):

In [changeset:"65bd053f11d22bca529f1da895599796fa0f3ee1" 65bd053f]:
{{{
#!CommitTicketReference repository=""
revision="65bd053f11d22bca529f1da895599796fa0f3ee1"
Fixed #26229 -- Improved check for model admin check admin.E124

Refs #22792
}}}

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

Django

unread,
Jan 31, 2017, 8:44:26 AM1/31/17
to django-...@googlegroups.com
#22792: Check rule for list_display_links is incorrect
---------------------------------+----------------------------------------
Reporter: Ben Davis | Owner: Greg Chapple
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.7-beta-2

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

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

Comment (by matsaman):

Replying to [comment:6 Tim Graham <timograham@…>]:
> …[changeset:"65bd053f11d22bca529f1da895599796fa0f3ee1" 65bd053f]…

Can we get this backported to 1.8?

{{{
- cls.list_display_links is not None):
+ not cls.list_display_links and cls.list_display_links
is not None):
}}}

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

Django

unread,
Jan 31, 2017, 9:09:15 AM1/31/17
to django-...@googlegroups.com
#22792: Check rule for list_display_links is incorrect
---------------------------------+----------------------------------------
Reporter: Ben Davis | Owner: Greg Chapple
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.7-beta-2

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

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

Comment (by Tim Graham):

Per our [https://docs.djangoproject.com/en/dev/internals/release-process
/#supported-versions supported versions policy], 1.8 is only receiving
fixes for security and data loss issues.

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

Reply all
Reply to author
Forward
0 new messages