#15185 closed New feature (fixed)
Ability to make all list_display fields not clickable
Reported by: | rm_ | Owned by: | petter |
---|---|---|---|
Component: | contrib.admin | Version: | 1.2 |
Severity: | Normal | Keywords: | list_display_links |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | yes |
Description
I have a model to store logs which have only not editable or auto-added fields which by default are not shown in a ModelAdmin; when i click in the admin interface the first element of list_display an empty form is shown which is very confusing for the user. I thoughtd that an empty list_display_links would make it but does not work as i expect. I can workaround this with some js but something from the django side would be handy.
Change History (13)
comment:1 by , 14 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 14 years ago
There is another piece of inconsistency in the current behaviour, I think. Here typically you seem to want to disallow any editing but allow the listing of your records, which sounds perfectly reasonable. However, if you override ModelAdmin.has_change_permission()
to return False
(as a way of disabling editing) then the list view is disabled altogether.
So I'm not sure what the most sensible approach would be between:
(1) As originally suggested, keep the change permission enabled and somehow disable list_display_links
.
(2) Make it so that if the change permission is disabled, you cannot edit records (either via the list view's edit inline feature or via a single record's change view) but you still can list your records.
If (2) is addressed, then one might argue that we'd need to introduce another standard permission (list), which may break backwards compatibility. But if (1) is addressed, then note that this wouldn't prevent users to manually type in the URL to access a record's change view.
comment:3 by , 14 years ago
See #11561 for another use case where the has_change_permission
gets in the way of displaying the change list.
comment:4 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → New feature |
comment:5 by , 13 years ago
UI/UX: | set |
---|
comment:6 by , 13 years ago
Easy pickings: | unset |
---|
On a related note, see #8936 about adding view-only functionality to the admin.
comment:8 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:9 by , 11 years ago
What about fixing this by allowing assigning None to list_display_links
?.
It would be consistent with actions
and would allow to solve this presentation issue without having to wait for another, greater design decision and change about if the admin app can be use as a browse-only tool.
comment:10 by , 11 years ago
See PR implementing last comment proposal at https://github.com/django/django/pull/1596
comment:11 by , 11 years ago
Has patch: | set |
---|---|
Triage Stage: | Accepted → Ready for checkin |
comment:12 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
It's an edge case, but I can't see a reason to disallow it. An empty ModelAdmin.list_display_links should disable *all* links, rather than forcing the first link to be a list.
I'm going to guess that this is a case of a check doing "if list_display_list:", rather than "if list_display_list is None".
As a workaround in the meantime, you may want to consider using readonly_fields to define a list of fields to display on the form -- not a perfect solution, but probably less confusing than an empty form.