#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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.ea74eba3d25038c111989a8bdee9c59c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to