Opened 14 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)
Change History (11)
comment:1 by , 14 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 14 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 14 years ago
Cc: | added |
---|---|
Owner: | changed from | to
Status: | assigned → new |
comment:4 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → New feature |
comment:5 by , 14 years ago
UI/UX: | set |
---|
by , 9 years ago
Attachment: | ellipsis_admin.zip added |
---|
Test project to illustrate long list_filter fields
comment:9 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
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.)
- Download and unzip the project
- Create a virtual env and
pip install django
./manage.py migrate
./manage.py runserver
- 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 , 8 years ago
Resolution: | → duplicate |
---|---|
Status: | assigned → closed |
Closing as a duplicate of #26066
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.