Opened 5 years ago

Last modified 5 years ago

#15188 new New feature

ellipsizing fields in list_display in admin

Reported by: bjourne Owned by: nobody
Component: contrib.admin Version: 1.2
Severity: Normal Keywords:
Cc: kotenko@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes


In the list_display for a model I have there are two url fields. When the urls are long, they word wrap which doesn't look good. I would prefer if there was some system in place to ellipsize fields instead of word wrapping.

Change History (8)

comment:1 Changed 5 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 5 years ago by jasonkotenko

  • Owner changed from nobody to jasonkotenko
  • Status changed from new to assigned

comment:3 Changed 5 years ago by jasonkotenko

  • Cc kotenko@… added
  • Owner changed from jasonkotenko to nobody
  • Status changed from assigned to new

I'm looking through the source on this one, and I'm beginning to wonder what the correct approach is. It appears that the actual code which produces the items in the Change List is the template tag helper function "items_for_result" starting line 128 in django/contrib/admin/templatetags/

The function handles every type of field the same, just outputting the unicode representation inside a <td> element. It appears to me, that if we place an exception for long URLs, we would have to introduce a "magic number".

Is the right place for this in a javascript file, since the size at which to ellipsize a field depends on the size of the user's browser? I'm going to relinquish control of the bug for now but keep my eye on it. I'm not ready to delve into the django javascript yet.

Last edited 5 years ago by jasonkotenko (previous) (diff)

comment:4 Changed 5 years ago by lrekucki

  • Severity set to Normal
  • Type set to New feature

comment:5 Changed 5 years ago by julien

  • UI/UX set

comment:6 Changed 4 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:7 Changed 4 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:8 Changed 4 years ago by aaugustin

  • UI/UX set

Revert accidental batch modification.

Note: See TracTickets for help on using tickets.
Back to Top