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..e13385f 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_capatible', 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_capatible: |
| 407 | return "Positive\n multiline\n capatible" |
| 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..da88f79 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 correct multiline text for readonly field |
| 3154 | self.assertContains(response, "Positive\n multiline\n capatible") |
| 3155 | |
3152 | 3156 | self.assertContains(response, |
3153 | 3157 | formats.localize(datetime.date.today() - datetime.timedelta(days=7)) |
3154 | 3158 | ) |
… |
… |
class ReadonlyTest(TestCase):
|
3166 | 3170 | p = Post.objects.create(title="I worked on readonly_fields", content="Its good stuff") |
3167 | 3171 | response = self.client.get('/test_admin/admin/admin_views/post/%d/' % p.pk) |
3168 | 3172 | self.assertContains(response, "%d amount of cool" % p.pk) |
3169 | | |
| 3173 | self.assertContains(response, new_post_title) |
| 3174 | |
3170 | 3175 | def test_readonly_post(self): |
3171 | 3176 | data = { |
3172 | 3177 | "title": "Django Got Readonly Fields", |