[Django] #26632: System check for list_display_links ignores value of ModelAdmin.get_list_display()

53 views
Skip to first unread message

Django

unread,
May 18, 2016, 3:16:18 AM5/18/16
to django-...@googlegroups.com
#26632: System check for list_display_links ignores value of
ModelAdmin.get_list_display()
-------------------------------+--------------------
Reporter: zachborboa | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.9
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
The list_display_links system check should also look at the values
returned by ModelAdmin.get_list_display() before displaying error
(admin.E111).

{{{#!python
# models
from django.db import models

class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
}}}

{{{#!python
# admin
from django.contrib import admin
from .models import Question

class QuestionAdmin(admin.ModelAdmin):
# list_display = ['id', 'pub_date', 'question_text']
list_display_links = ['id', 'pub_date', 'question_text',]

def get_list_display(self, request):
return ['id', 'pub_date', 'question_text']

admin.site.register(Question, QuestionAdmin)
}}}

{{{
$ python manage.py check
SystemCheckError: System check identified some issues:

ERRORS:
<class 'myapp.admin.QuestionAdmin'>: (admin.E111) The value of
'list_display_links[0]' refers to 'id', which is not defined in
'list_display'.
<class 'myapp.admin.QuestionAdmin'>: (admin.E111) The value of
'list_display_links[1]' refers to 'pub_date', which is not defined in
'list_display'.
<class 'myapp.admin.QuestionAdmin'>: (admin.E111) The value of
'list_display_links[2]' refers to 'question_text', which is not defined in
'list_display'.
}}}

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

Django

unread,
May 18, 2016, 8:16:20 AM5/18/16
to django-...@googlegroups.com
#26632: System check for list_display_links ignores value of
ModelAdmin.get_list_display()
-------------------------------+------------------------------------
Reporter: zachborboa | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.9
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 timgraham):

* needs_better_patch: => 0
* component: Uncategorized => contrib.admin
* needs_tests: => 0
* needs_docs: => 0
* type: Uncategorized => Bug
* stage: Unreviewed => Accepted


Comment:

I don't think we can check these methods because we'd need an
`HttpRequest`.

As [https://groups.google.com/d/msg/django-developers/WrnhmTyLHuY/LI-
MROj_J1cJ Luke said], "I think the problems with the false negatives for
the admin checks may need to be solved another way - namely by removing
them. That's unfortunate, but I found them tricky in the past - they may
prevent common errors, but they also prevent more advanced ways that you
might want to use the admin."

Maybe we could try disabling each check if the method version of check's
attribute is defined.

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

Django

unread,
Nov 25, 2016, 6:03:02 PM11/25/16
to django-...@googlegroups.com
#26632: System check for list_display_links ignores value of
ModelAdmin.get_list_display()
-------------------------------+------------------------------------
Reporter: Zach Borboa | Owner: nobody
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):

* cc: desecho@… (added)
* has_patch: 0 => 1
* version: 1.9 => master


Comment:

Added [https://github.com/django/django/pull/7620 PR].

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

Django

unread,
Nov 25, 2016, 6:21:34 PM11/25/16
to django-...@googlegroups.com
#26632: System check for list_display_links ignores value of
ModelAdmin.get_list_display()
-------------------------------+------------------------------------
Reporter: Zach Borboa | Owner: nobody
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
-------------------------------+------------------------------------

Comment (by Simon Charette):

What about adding a hint to the error that you should override
`get_list_display_link()` to return dynamic results if
`get_list_display()` was overrode?

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

Django

unread,
Nov 28, 2016, 8:28:47 AM11/28/16
to django-...@googlegroups.com
#26632: System check for list_display_links ignores value of
ModelAdmin.get_list_display()
-------------------------------+------------------------------------
Reporter: Zach Borboa | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

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

* needs_tests: 0 => 1


Comment:

A test is also needed.

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

Django

unread,
Nov 29, 2016, 11:10:48 AM11/29/16
to django-...@googlegroups.com
#26632: System check for list_display_links ignores value of
ModelAdmin.get_list_display()
-------------------------------+------------------------------------
Reporter: Zach Borboa | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

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

Comment (by Anton Samarchyan):

Replying to [comment:3 Simon Charette]:


> What about adding a hint to the error that you should override
`get_list_display_link()` to return dynamic results if
`get_list_display()` was overrode?

Currently, I silence all errors if get_list_display() is overridden. Do
you want to bring the errors back or create a new error or else?

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

Django

unread,
Nov 29, 2016, 11:25:07 AM11/29/16
to django-...@googlegroups.com
#26632: System check for list_display_links ignores value of
ModelAdmin.get_list_display()
-------------------------------+------------------------------------
Reporter: Zach Borboa | Owner: nobody
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):

* needs_tests: 1 => 0


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

Django

unread,
Dec 22, 2016, 9:55:14 AM12/22/16
to django-...@googlegroups.com
#26632: System check for list_display_links ignores value of
ModelAdmin.get_list_display()
-------------------------------+------------------------------------
Reporter: Zach Borboa | Owner: nobody
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
* resolution: => fixed


Comment:

In [changeset:"da792400503265a80e5307f17e59b65ec88694aa" da792400]:
{{{
#!CommitTicketReference repository=""
revision="da792400503265a80e5307f17e59b65ec88694aa"
Fixed #26632 -- Skipped admin.E111 list_display_links check if
get_list_display() is overridden.
}}}

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

Reply all
Reply to author
Forward
0 new messages