#29992: Error in admin checking list_display items
-------------------------------------------+------------------------
               Reporter:  gtoffoli         |          Owner:  nobody
                   Type:  Bug              |         Status:  new
              Component:  contrib.admin    |        Version:  2.1
               Severity:  Release blocker  |       Keywords:
           Triage Stage:  Unreviewed       |      Has patch:  0
    Needs documentation:  0                |    Needs tests:  0
Patch needs improvement:  0                |  Easy pickings:  0
                  UI/UX:  0                |
-------------------------------------------+------------------------
 I'm porting my app from Django 1.8 and 2.0.6 to **Django 2.1.3**.
 In the last environment, ''runserver'' emits a lot of system check issues
 of type **admin.E108**
 They refer to fields from different modules and many different classes,
 but all of them are ''CharField'' or ''TextField''.

 I see that method **_check_list_display_item** of class
 ''ModelAdminChecks'' in module ''check'' of ''django.contrib.admin'' has
 changed significantly between releases 2.0.6 and 2.1.3; in the latter, has
 been removed the last branch (else) of the top-level if-elif-else
 structure, although it was explicitly stated, in a comment inside it, that
 the associated path was required.

 I'm not able to make a complete diagnosis, but it seems that testing

 {{{
 hasattr(model, item)
 }}}

 in general gives a different result than testing the existence of the same
 field with

 {{{
 model._meta.get_field(item)
 }}}

 In fact, using the ''manage.py shell'' command, I experimentally verified
 such difference on a subset of the fields presenting the above mentioned
 problem: the ''hasattr'' test yields sometimes True and sometimes False
 (don't know why), while the other way of testing the existence of the
 field always yields a True result.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29992>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.0c98f86bff311182c4fe43aa877c01ab%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to