Opened 4 weeks ago

Last modified 12 days ago

#36554 assigned Bug

When the object __str__ is long, the object title is truncated in TabularInline.

Reported by: Antoliny Owned by: Antoliny
Component: contrib.admin Version: 5.2
Severity: Normal Keywords: inline
Cc: Antoliny Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes

Description (last modified by Antoliny)

In TabularInline, there is an issue where the text gets cut off when the object's __str__ is long.


The above image is fine because the screen is wide, but on a mobile screen, the text gets cut off as shown below.


Recently, the font size of TabularInline was made the same as StackedInline https://github.com/django/django/commit/65377325855ab6faa7ac487e336e9902c6268c96, resulting in a larger font than before.

As a result, the likelihood of this issue occurring has increased, and as seen in the above image, links rendered via show_change_link are also cut off, preventing the use of the features provided by default.

Attachments (2)

Screenshot 2025-08-15 at 11.58.32 AM.png (28.6 KB ) - added by Antoliny 4 weeks ago.
tabular_object_str.png (51.7 KB ) - added by Antoliny 4 weeks ago.

Download all attachments as: .zip

Change History (14)

comment:1 by Antoliny, 4 weeks ago

Component: contrib.admindocscontrib.admin

comment:2 by Antoliny, 4 weeks ago

Description: modified (diff)

by Antoliny, 4 weeks ago

Attachment: tabular_object_str.png added

comment:3 by Antoliny, 4 weeks ago

Description: modified (diff)

comment:4 by Antoliny, 4 weeks ago

Summary: In TabularInline, the text is truncated when the object's __str__ is too long.When the object __str__ is long, the text is truncated in TabularInline.

comment:5 by Sarah Boyce, 4 weeks ago

Summary: When the object __str__ is long, the text is truncated in TabularInline.When the object __str__ is long, the object title is truncated in TabularInline.
Triage Stage: UnreviewedAccepted

I think the title can have a "..." when truncating so that folks know that the title has been truncated and the change button should always be available

comment:6 by Antoliny, 4 weeks ago

Owner: set to Antoliny
Status: newassigned

in reply to:  5 comment:7 by Antoliny, 4 weeks ago

Replying to Sarah Boyce:

I think the title can have a "..." when truncating so that folks know that the title has been truncated and the change button should always be available

If we could solve the problem in the most ideal way, it would be to show the entire title text, right?
I’m concerned that using truncation, especially with mobile sizes in mind, might result in showing too little of the title.

Version 0, edited 4 weeks ago by Antoliny (next)

comment:8 by Sarah Boyce, 4 weeks ago

I suppose it should be consistent with other titles, such as for StackedInline

in reply to:  8 comment:9 by Antoliny, 4 weeks ago

Replying to Sarah Boyce:

I suppose it should be consistent with other titles, such as for StackedInline

This is a post I wrote on the forum a while ago. If you have some time, could you take a look at it?
How about solving it using this approach?

https://forum.djangoproject.com/t/improving-consistency-and-accessibility-between-tabularinline-and-stackedinline/37951/2

If we adopt this approach, I think we would only need to adjust the position of the View On Site link.

comment:10 by Antoliny, 4 weeks ago

Has patch: set

comment:11 by Sarah Boyce, 2 weeks ago

Patch needs improvement: set

comment:12 by Antoliny, 12 days ago

Patch needs improvement: unset
Note: See TracTickets for help on using tickets.
Back to Top