From 553838a285d6ef4005d7a97fc07aebfb0dcdb921 Mon Sep 17 00:00:00 2001 From: Marc Aymerich Date: Thu, 6 Dec 2012 09:47:51 +0100 Subject: [PATCH] Fixed #19429 -- Applied linebreaksbr to read-only fields in inlines Applied to inlines what ec9d6b1122d did for main fieldsets. --- .../contrib/admin/templates/admin/edit_inline/tabular.html | 2 +- tests/regressiontests/admin_views/admin.py | 5 ++++- tests/regressiontests/admin_views/tests.py | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/django/contrib/admin/templates/admin/edit_inline/tabular.html b/django/contrib/admin/templates/admin/edit_inline/tabular.html index f2757ede48..71a62ba71a 100644 --- a/django/contrib/admin/templates/admin/edit_inline/tabular.html +++ b/django/contrib/admin/templates/admin/edit_inline/tabular.html @@ -46,7 +46,7 @@ {% for field in line %} {% if field.is_readonly %} -

{{ field.contents }}

+

{{ field.contents|linebreaksbr }}

{% else %} {{ field.field.errors.as_ul }} {{ field.field }} diff --git a/tests/regressiontests/admin_views/admin.py b/tests/regressiontests/admin_views/admin.py index d71c398376..1e4e9b5c75 100644 --- a/tests/regressiontests/admin_views/admin.py +++ b/tests/regressiontests/admin_views/admin.py @@ -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): diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py index bbb8281fed..10f946132d 100644 --- a/tests/regressiontests/admin_views/tests.py +++ b/tests/regressiontests/admin_views/tests.py @@ -3164,6 +3164,7 @@ class ReadonlyTest(TestCase): # Checks that multiline text in a readonly field gets
tags self.assertContains(response, "Multiline
test
string") + self.assertContains(response, "InlineMultiline
test
string") self.assertContains(response, formats.localize(datetime.date.today() - datetime.timedelta(days=7))