diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
index 19c212d..7a5e93c 100644
a
|
b
|
class InlineModelAdmin(BaseModelAdmin):
|
1467 | 1467 | "fields": fields, |
1468 | 1468 | "exclude": exclude, |
1469 | 1469 | "formfield_callback": partial(self.formfield_for_dbfield, request=request), |
1470 | | "extra": self.extra, |
1471 | | "max_num": self.max_num, |
| 1470 | "extra": self.get_extra(), |
| 1471 | "max_num": self.get_max_num(), |
1472 | 1472 | "can_delete": can_delete, |
1473 | 1473 | } |
1474 | 1474 | defaults.update(kwargs) |
… |
… |
class InlineModelAdmin(BaseModelAdmin):
|
1519 | 1519 | return request.user.has_perm( |
1520 | 1520 | self.opts.app_label + '.' + self.opts.get_delete_permission()) |
1521 | 1521 | |
| 1522 | def get_extra(self): |
| 1523 | return self.extra |
| 1524 | |
| 1525 | def get_max_num(self): |
| 1526 | return self.max_num |
| 1527 | |
1522 | 1528 | |
1523 | 1529 | class StackedInline(InlineModelAdmin): |
1524 | 1530 | template = 'admin/edit_inline/stacked.html' |
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/tests.py b/tests/regressiontests/admin_views/tests.py
index 72dc6a3..1bbf60f 100644
a
|
b
|
class ReadonlyTest(TestCase):
|
3163 | 3163 | self.assertContains(response, '<p class="help">Some help text for the content (with unicode ŠĐĆŽćžšđ)</p>', html=True) |
3164 | 3164 | self.assertContains(response, '<p class="help">Some help text for the date (with unicode ŠĐĆŽćžšđ)</p>', html=True) |
3165 | 3165 | |
3166 | | p = Post.objects.create(title="I worked on readonly_fields", content="Its good stuff") |
| 3166 | new_post_title = "I worked on\n multiline\n readonly_fields" |
| 3167 | p = Post.objects.create(title=new_post_title, content="Its good stuff") |
3167 | 3168 | response = self.client.get('/test_admin/admin/admin_views/post/%d/' % p.pk) |
3168 | 3169 | self.assertContains(response, "%d amount of cool" % p.pk) |
3169 | | |
| 3170 | self.assertContains(response, new_post_title) |
| 3171 | |
3170 | 3172 | def test_readonly_post(self): |
3171 | 3173 | data = { |
3172 | 3174 | "title": "Django Got Readonly Fields", |