Ticket #9969: t9969-r9701.diff

File t9969-r9701.diff, 1.3 KB (added by Ramiro Morales, 16 years ago)

Patch thta fixes the issue, no tests yet

  • django/contrib/admin/templatetags/admin_list.py

     
    7070
    7171def result_headers(cl):
    7272    lookup_opts = cl.lookup_opts
    73    
     73
    7474    for i, field_name in enumerate(cl.list_display):
    7575        attr = None
    7676        try:
     
    9797                            raise AttributeError, \
    9898                                "'%s' model or '%s' objects have no attribute '%s'" % \
    9999                                    (lookup_opts.object_name, cl.model_admin.__class__, field_name)
    100                
     100
    101101                try:
    102102                    header = attr.short_description
    103103                except AttributeError:
     
    205205                    result_repr = EMPTY_CHANGELIST_VALUE
    206206            # Fields with choices are special: Use the representation
    207207            # of the choice.
    208             elif f.choices:
    209                 result_repr = dict(f.choices).get(field_val, EMPTY_CHANGELIST_VALUE)
     208            elif f.flatchoices:
     209                result_repr = dict(f.flatchoices).get(field_val, EMPTY_CHANGELIST_VALUE)
    210210            else:
    211211                result_repr = escape(field_val)
    212212        if force_unicode(result_repr) == '':
Back to Top