Opened 5 weeks ago

Closed 4 weeks ago

Last modified 4 weeks ago

#36080 closed Cleanup/optimization (wontfix)

Cleanup the inline link format.

Reported by: Antoliny Owned by: Antoliny
Component: contrib.admin Version: dev
Severity: Normal Keywords: Inline, Link
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Antoliny)

when show_change_link is applied, the icon image appears slightly cropped in TabularInline. Also, the Change and View text is applied depending on the user's permissions, but the permission-related details are already exposed in the form.

Therefore, how about simply adding the link to the object's __str__?

I think it looks cleaner when the link is added to the __str__(removed icon and text).
Additionally, what do you think about changing the default value of show_change_link to True?
Changing it to True could also improve accessibility.

Attachments (5)

tabular_inline_object_str_link.png (52.8 KB ) - added by Antoliny 5 weeks ago.
inline_object_str_add_link.png (35.5 KB ) - added by Antoliny 5 weeks ago.
image-20250110-114223.png (12.0 KB ) - added by Sarah Boyce 5 weeks ago.
tabular_inline_link.png (31.1 KB ) - added by Antoliny 5 weeks ago.
link_change_2.png (46.8 KB ) - added by Antoliny 5 weeks ago.

Download all attachments as: .zip

Change History (15)

by Antoliny, 5 weeks ago

comment:1 by Antoliny, 5 weeks ago

Owner: set to Antoliny
Status: newassigned

by Antoliny, 5 weeks ago

comment:2 by Antoliny, 5 weeks ago

Description: modified (diff)

by Sarah Boyce, 5 weeks ago

Attachment: image-20250110-114223.png added

comment:3 by Sarah Boyce, 5 weeks ago

Resolution: invalid
Status: assignedclosed

This exists already but you need to have the admin registered for that model for the link to be available


by Antoliny, 5 weeks ago

Attachment: tabular_inline_link.png added

by Antoliny, 5 weeks ago

Attachment: link_change_2.png added

comment:4 by Antoliny, 5 weeks ago

Ah, this functionality is already provided through the show_change_link attribute! However, when show_change_link is applied, the icon image appears slightly cropped in TabularInline. Also, the Change and View text is applied depending on the user's permissions, but the permission-related details are already exposed in the form.

Therefore, what do you think about simply adding the link to the object's str and change the default value of the show_change_link to True? (This includes StackedInline as well.) I think this approach would be cleaner, more intuitive, and would enhance accessibility without losing any clarity.

comment:5 by Antoliny, 4 weeks ago

Description: modified (diff)
Resolution: invalid
Status: closednew
Summary: Add a link to navigate to the object through str in the inline form.Cleanup the inline link format.

comment:6 by Antoliny, 4 weeks ago

Status: newassigned

comment:7 by Antoliny, 4 weeks ago

Type: New featureCleanup/optimization

comment:8 by Sarah Boyce, 4 weeks ago

Resolution: wontfix
Status: assignedclosed

Could you raise this on the forum?
I think the change/view link pattern exists in a few places and we should check each of them together to complete the proposal.

We should be clear when that patter should be used vs applying a link to the string. The accessibility team should also consider this. I would say right now the buttons are always the same size regardless of the size of __str__ but this could return "-" or possibly even a blank string which would not be clickable

I also don't like that the stacked inline has the model name prefix but the tabular does not

comment:9 by Antoliny, 4 weeks ago

Hmm.. You're right. We need to consider cases where the __str__ method returns elements like "-" or an empty string when applying a link.
I also previously mentioned the difference between Stacked Inline and Tabular Inline headers in another issue.
I don't understand why the headers for these two features are different either. Considering the issue raised in ticket_36079, I feel that changes to the Tabular Inline and Stacked Inline headers are necessary. Thank you, Sarah Boyce! I will write a post about this on the Django forum internals.

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