diff --git a/django/contrib/admin/templates/admin/includes/fieldset.html b/django/contrib/admin/templates/admin/includes/fieldset.html
index c8d08c8..09bc971 100644
a
|
b
|
|
14 | 14 | {% else %} |
15 | 15 | {{ field.label_tag }} |
16 | 16 | {% if field.is_readonly %} |
17 | | <p>{{ field.contents }}</p> |
| 17 | <p>{{ field.contents|linebreaksbr }}</p> |
18 | 18 | {% else %} |
19 | 19 | {{ field.field }} |
20 | 20 | {% endif %} |
diff --git a/tests/regressiontests/admin_views/admin.py b/tests/regressiontests/admin_views/admin.py
index a5476e9..6f6f1d1 100644
a
|
b
|
class PrePopulatedPostAdmin(admin.ModelAdmin):
|
388 | 388 | |
389 | 389 | class PostAdmin(admin.ModelAdmin): |
390 | 390 | list_display = ['title', 'public'] |
391 | | readonly_fields = ('posted', 'awesomeness_level', 'coolness', 'value', lambda obj: "foo") |
| 391 | readonly_fields = ('posted', 'awesomeness_level', 'coolness', 'value', 'multiline', lambda obj: "foo") |
392 | 392 | |
393 | 393 | inlines = [ |
394 | 394 | LinkInline |
… |
… |
class PostAdmin(admin.ModelAdmin):
|
402 | 402 | |
403 | 403 | def value(self, instance): |
404 | 404 | return 1000 |
| 405 | |
| 406 | def multiline(self, instance): |
| 407 | return "Multiline\ntest\nstring" |
| 408 | |
405 | 409 | value.short_description = 'Value in $US' |
406 | 410 | |
407 | 411 | |
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
index 72dc6a3..b5e0f40 100644
a
|
b
|
class ReadonlyTest(TestCase):
|
3149 | 3149 | self.assertContains(response, "Very awesome.") |
3150 | 3150 | self.assertContains(response, "Unkown coolness.") |
3151 | 3151 | self.assertContains(response, "foo") |
| 3152 | |
| 3153 | # Checks that multiline text in a readonly field gets <br /> tags |
| 3154 | self.assertContains(response, "Multiline<br />test<br />string") |
| 3155 | |
3152 | 3156 | self.assertContains(response, |
3153 | 3157 | formats.localize(datetime.date.today() - datetime.timedelta(days=7)) |
3154 | 3158 | ) |