mirror of
https://github.com/django/django.git
synced 2025-03-08 08:22:33 +00:00
Fixed #19429 -- Applied linebreaksbr to read-only fields in inlines
Applied to inlines what ec9d6b1122d did for main fieldsets.
This commit is contained in:
parent
37abad73d6
commit
553838a285
django/contrib/admin/templates/admin/edit_inline
tests/regressiontests/admin_views
@ -46,7 +46,7 @@
|
||||
{% for field in line %}
|
||||
<td{% if field.field.name %} class="field-{{ field.field.name }}"{% endif %}>
|
||||
{% if field.is_readonly %}
|
||||
<p>{{ field.contents }}</p>
|
||||
<p>{{ field.contents|linebreaksbr }}</p>
|
||||
{% else %}
|
||||
{{ field.field.errors.as_ul }}
|
||||
{{ field.field }}
|
||||
|
@ -346,7 +346,10 @@ class LinkInline(admin.TabularInline):
|
||||
model = Link
|
||||
extra = 1
|
||||
|
||||
readonly_fields = ("posted",)
|
||||
readonly_fields = ("posted", "multiline")
|
||||
|
||||
def multiline(self, instance):
|
||||
return "InlineMultiline\ntest\nstring"
|
||||
|
||||
|
||||
class SubPostInline(admin.TabularInline):
|
||||
|
@ -3164,6 +3164,7 @@ class ReadonlyTest(TestCase):
|
||||
|
||||
# Checks that multiline text in a readonly field gets <br /> tags
|
||||
self.assertContains(response, "Multiline<br />test<br />string")
|
||||
self.assertContains(response, "InlineMultiline<br />test<br />string")
|
||||
|
||||
self.assertContains(response,
|
||||
formats.localize(datetime.date.today() - datetime.timedelta(days=7))
|
||||
|
Loading…
x
Reference in New Issue
Block a user