Opened 13 years ago

Closed 8 years ago

#15188 closed New feature (duplicate)

ellipsizing fields in list_display in admin

Reported by: bjourne Owned by: Markus Amalthea Magnuson
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

Description

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.

Attachments (1)

ellipsis_admin.zip (14.7 KB ) - added by Markus Amalthea Magnuson 8 years ago.
Test project to illustrate long list_filter fields

Download all attachments as: .zip

Change History (11)

comment:1 by Russell Keith-Magee, 13 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Jason Kotenko, 13 years ago

Owner: changed from nobody to Jason Kotenko
Status: newassigned

comment:3 by Jason Kotenko, 13 years ago

Cc: kotenko@… added
Owner: changed from Jason Kotenko to nobody
Status: assignednew

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/admin_list.py.

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 13 years ago by Jason Kotenko (previous) (diff)

comment:4 by Łukasz Rekucki, 13 years ago

Severity: Normal
Type: New feature

comment:5 by Julien Phalip, 13 years ago

UI/UX: set

comment:6 by Aymeric Augustin, 12 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:7 by Aymeric Augustin, 12 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:8 by Aymeric Augustin, 12 years ago

UI/UX: set

Revert accidental batch modification.

by Markus Amalthea Magnuson, 8 years ago

Attachment: ellipsis_admin.zip added

Test project to illustrate long list_filter fields

comment:9 by Markus Amalthea Magnuson, 8 years ago

Owner: changed from nobody to Markus Amalthea Magnuson
Status: newassigned

It seems like long lines in list_filter fields in admin are not wrapped anymore if they are entirely uninterrupted by e.g. hyphens, spaces etc. Instead they overflow with a horizontal scrollbar. Attached is a test project that illustrates this through a very long URL, per the original ticket. (The project has migrations that create the data and an admin user.)

  1. Download and unzip the project
  2. Create a virtual env and pip install django
  3. ./manage.py migrate
  4. ./manage.py runserver
  5. Go to http://localhost:8000/admin/app/mymodel/ and log in with user "test" and password "test"

This ticket might be a wontfix, in favor of https://code.djangoproject.com/ticket/26066

comment:10 by Tim Graham, 8 years ago

Resolution: duplicate
Status: assignedclosed

Closing as a duplicate of #26066

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