Opened 15 months ago

Closed 6 months ago

#31181 closed New feature (fixed)

Admin: Render foreign key models as links for readonly users

Reported by: Julien Rebetez Owned by: Julien Rebetez
Component: contrib.admin Version: dev
Severity: Normal Keywords:
Cc: Jeongsoo, Park Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes

Description

In the admin UI, when viewing a model for which you have view only permission, foreign key / m2m fields are rendered as plaintext representation of the target object.

It would be nicer to render those as links instead so that a readonly user can navigate through the relationships.

The link should only be rendered if the user has permission to view the target model.

django-developers discussion: https://groups.google.com/forum/#!topic/django-developers/XFoaohDpqZE

Change History (11)

comment:2 Changed 15 months ago by Carlton Gibson

Triage Stage: UnreviewedAccepted
Version: 3.0master

Hi Julian. Thanks for this. I agree, it does sound like a nice enhancement.

Please open a PR from your branch. Commit message/title Fixed #31181 -- Added links....
If you could post a small screenshot of two, showing the improvement, that makes it easier at first glance too.

comment:3 Changed 15 months ago by Julien Rebetez

Thanks! Here is the PR : https://github.com/django/django/pull/12343

I've added screenshots directly in the PR. There are also some open questions / points to discuss in the description of the PR.

comment:4 Changed 15 months ago by Claude Paroz

Has patch: set

comment:5 Changed 14 months ago by Mariusz Felisiak

Patch needs improvement: set

PR

We should skip m2m fields in this change.

comment:6 Changed 14 months ago by Julien Rebetez

I've amended the github PR to not include m2m

comment:7 Changed 10 months ago by Jeongsoo, Park

Cc: Jeongsoo, Park added

comment:8 Changed 6 months ago by Mariusz Felisiak

Patch needs improvement: unset

comment:9 Changed 6 months ago by Mariusz Felisiak

Needs documentation: set
Patch needs improvement: set

comment:10 Changed 6 months ago by Julien Rebetez

Needs documentation: unset
Patch needs improvement: unset

I've updated the PR to address the reviewer's comments. I've also added a small release note line.

comment:11 Changed 6 months ago by Mariusz Felisiak <felisiak.mariusz@…>

Resolution: fixed
Status: assignedclosed

In b7908830:

Fixed #31181 -- Added links to related models for admin's readonly fields.

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