#16080: list_filter broken for fields with lenght 2
-------------------------------+-------------------------------
 Reporter:  ales_zoulek        |          Owner:  nobody
     Type:  Bug                |         Status:  new
Milestone:                     |      Component:  contrib.admin
  Version:  SVN                |       Severity:  Normal
 Keywords:  list_filter admin  |   Triage Stage:  Unreviewed
Has patch:  0                  |  Easy pickings:  0
-------------------------------+-------------------------------
 Commit 16144 broke list_filter refering to model fields, when its name is
 just 2 chars long.

 Consider admin options class having

 {{{
 class VenueOptions(admin.ModelAdmin)
     list_filter = ('at', 'when',)
 }}}



 Then in django/contrib/admin/validation.py loops over items in list_filter
 this way:


 {{{

                    # item = 'at'

                    #....

 76                 try:
 77                     # Check for option #2 (tuple)
 78                     field, list_filter_class = item
 79                 except (TypeError, ValueError):
 80                     # item is option #1
 81                     field = item
 }}}

 The check for tuple will fail, since the result would be
 {{{

 field, list_filter_class = 'at'
 # results in:
 field = 'a'
 list_filter_class = 't'
 }}}


 (Tested on svn rev: 16270)

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16080>
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to