Code

Opened 5 years ago

Closed 5 years ago

#12136 closed (duplicate)

Minor visual problem in django admin (and correction)

Reported by: deloide Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords: admin contrib
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

When I use callables in the 'list_display' property of the Admin class, the header columns (names of those properties) are not displayed correctly (see screenshot here: http://bit.ly/1bVz1R).
After investigating a little I found that it was because a missing property (class_attrib) of the header object:

This correction works for me (file: admin_list.py in django/contrib/admin/templatetags/, line 116):

            # It is a non-field, but perhaps one that is sortable
            admin_order_field = getattr(attr, "admin_order_field", None)
            if not admin_order_field:
                yield {"text": header,
                       "class_attrib": "", # line added
                       }
                continue

Attachments (0)

Change History (2)

comment:1 follow-up: Changed 5 years ago by deloide

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Small precision: the problem is only there if TEMPLATE_STRING_IF_INVALID is set to something other than .

comment:2 in reply to: ↑ 1 Changed 5 years ago by kmtracey

  • Resolution set to duplicate
  • Status changed from new to closed

Replying to deloide:

Small precision: the problem is only there if TEMPLATE_STRING_IF_INVALID is set to something other than .

Then it's a dupe of #3579.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.