Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.5.x] Fixed #19429 -- Applied linebreaksbr to read-only fields in i…

…nlines

Applied to inlines what ec9d6b1 did for main fieldsets.
Backport of 553838a from master.
  • Loading branch information...
commit 57a41d985acabc7fc25f08081e58f0978cc8c1dc 1 parent a8045c3
authored December 06, 2012 claudep committed December 06, 2012
2  django/contrib/admin/templates/admin/edit_inline/tabular.html
@@ -46,7 +46,7 @@
46 46
             {% for field in line %}
47 47
               <td{% if field.field.name %} class="field-{{ field.field.name }}"{% endif %}>
48 48
               {% if field.is_readonly %}
49  
-                  <p>{{ field.contents }}</p>
  49
+                  <p>{{ field.contents|linebreaksbr }}</p>
50 50
               {% else %}
51 51
                   {{ field.field.errors.as_ul }}
52 52
                   {{ field.field }}
5  tests/regressiontests/admin_views/admin.py
@@ -346,7 +346,10 @@ class LinkInline(admin.TabularInline):
346 346
     model = Link
347 347
     extra = 1
348 348
 
349  
-    readonly_fields = ("posted",)
  349
+    readonly_fields = ("posted", "multiline")
  350
+
  351
+    def multiline(self, instance):
  352
+        return "InlineMultiline\ntest\nstring"
350 353
 
351 354
 
352 355
 class SubPostInline(admin.TabularInline):
1  tests/regressiontests/admin_views/tests.py
@@ -3164,6 +3164,7 @@ def test_readonly_get(self):
3164 3164
 
3165 3165
         # Checks that multiline text in a readonly field gets <br /> tags
3166 3166
         self.assertContains(response, "Multiline<br />test<br />string")
  3167
+        self.assertContains(response, "InlineMultiline<br />test<br />string")
3167 3168
 
3168 3169
         self.assertContains(response,
3169 3170
             formats.localize(datetime.date.today() - datetime.timedelta(days=7))

0 notes on commit 57a41d9

Please sign in to comment.
Something went wrong with that request. Please try again.