Display link to change-form on inlines where model is registered in admin site
|Reported by:||DrMeers||Owned by:||DrMeers|
|Cc:||sree@…, cg@…, glicerinu@…||Triage Stage:||Accepted|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||yes||Patch needs improvement:||yes|
If an inline object has a get_absolute_url method, a 'View on site' link is displayed.
Here I propose that if an inline object is registered in the same admin site, an 'Edit' link is displayed in a similar fashion.
- The inline may only display a subset of fields, so the user may wish to go to the full change form
- 'Recursive inlines' can be accessed more easily -- e.g. Household has Person inlines, and Person has Phone inlines, etc.
The attached patch shows a draft implementation.
- Do we need to check if the user has change permissions on that model before displaying the link? (in the unlikely event that the user has permission to change a model which displays the inlines of a model which they do not have change permissions for). Given that I cannot see a straightforward way of checking for this without the addition of a template tag/filter, and the rarity of such setups, I'd be happy to let the user click the link and get a permission denied page.
- Do we need an InlineModelAdmin option for enabling/disabling this link? E.g. InlineModelAdmin.show_admin_link. Or are we happy to have it enabled globally?
- Is [ Edit ] a sufficiently understandable link label? Would "Edit in Admin", or "Display full form" or something be more appropriate?
I think the reciprocal of this would also be very useful -- ForeignKey widgets could display an  link beside the "add new" (green +) link which links to the change form for the selected parent object.
Change History (23)
comment:1 Changed 4 years ago by kmtracey
- milestone 1.2 deleted
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:2 Changed 4 years ago by russellm
- Component changed from django.contrib.admin to User Experience
- Owner nobody deleted
- Triage Stage changed from Unreviewed to Accepted