Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#25465 closed Bug (fixed)

Line breaks in readonly field in admin tabular inline

Reported by: Patrick Craston Owned by: nobody
Component: contrib.admin Version: 1.8
Severity: Normal Keywords: tabular inline
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If a model TextField is rendered as read-only inside a included fieldset or an admin.TabularInline section, line breaks are ignored.

This is because of the changes made in https://github.com/django/django/commit/c94bff2b26f8844fe15d68a79511ff3a6853dc61 :
to these files:
django/contrib/admin/templates/admin/edit_inline/tabular.html
django/contrib/admin/templates/admin/includes/fieldset.html

Specifically the following code change in both files:

{% if field.is_readonly %}
-                  <p>{{ field.contents|linebreaksbr }}</p>
+                  <p>{{ field.contents }}</p>

The linebreaksbr template tag was removed but the django/contrib/admin/helpers.py:186 linebreaksbr function is only applied to custom ModelAdmin methods but not plain admin fields

Am I missing something or is this a bug?

Change History (11)

comment:1 by Tim Graham, 9 years ago

Triage Stage: UnreviewedAccepted

It seems this was probably an oversight.

comment:3 by Sasha Gaevsky, 9 years ago

Has patch: set
Version: 1.8master

comment:4 by Tim Graham, 9 years ago

Needs tests: set
Patch needs improvement: set

comment:5 by Tim Graham, 9 years ago

The ticket "Version" field is the version the ticket is reported in and generally doesn't need to be updated to "master" (if the issue is no longer relevant on master, then the ticket is can usually be closed). If this is a regression in 1.8, then it qualifies for a backport.

in reply to:  5 comment:6 by Sasha Gaevsky, 9 years ago

Replying to timgraham:

The ticket "Version" field is the version the ticket is reported in and generally doesn't need to be updated to "master" (if the issue is no longer relevant on master, then the ticket is can usually be closed).

Ok, thanks for the info, will consider in the future.

If this is a regression in 1.8, then it qualifies for a backport.

Yes, it's a regression, but appeared to be in 1.7.

Version 0, edited 9 years ago by Sasha Gaevsky (next)

comment:7 by Tim Graham, 9 years ago

Needs tests: unset
Patch needs improvement: unset

comment:8 by Tim Graham, 9 years ago

Triage Stage: AcceptedReady for checkin
Version: master1.8

comment:9 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: newclosed

In 69208a5:

Fixed #25465 -- Restored line breaks conversion in admin readonly fields.

comment:10 by Tim Graham <timograham@…>, 9 years ago

In 312e488:

[1.9.x] Fixed #25465 -- Restored line breaks conversion in admin readonly fields.

Backport of 69208a5a1c55d42ca0eaffa900be643d9f801089 from master

comment:11 by Tim Graham <timograham@…>, 9 years ago

In 83174866:

[1.8.x] Fixed #25465 -- Restored line breaks conversion in admin readonly fields.

Backport of 69208a5a1c55d42ca0eaffa900be643d9f801089 from master

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