Ticket #19429: ticket_19429.diff

File ticket_19429.diff, 1.8 KB (added by glic3rinu, 2 years ago)
  • django/contrib/admin/templates/admin/edit_inline/tabular.html

    diff --git a/django/contrib/admin/templates/admin/edit_inline/tabular.html b/django/contrib/admin/templates/admin/edit_inline/tabular.html
    index f2757ed..71a62ba 100644
    a b  
    4646            {% for field in line %}
    4747              <td{% if field.field.name %} class="field-{{ field.field.name }}"{% endif %}>
    4848              {% if field.is_readonly %}
    49                   <p>{{ field.contents }}</p>
     49                  <p>{{ field.contents|linebreaksbr }}</p>
    5050              {% else %}
    5151                  {{ field.field.errors.as_ul }}
    5252                  {{ field.field }}
  • tests/regressiontests/admin_views/admin.py

    diff --git a/tests/regressiontests/admin_views/admin.py b/tests/regressiontests/admin_views/admin.py
    index d71c398..1e4e9b5 100644
    a b class LinkInline(admin.TabularInline): 
    346346    model = Link
    347347    extra = 1
    348348
    349     readonly_fields = ("posted",)
     349    readonly_fields = ("posted", "multiline")
     350
     351    def multiline(self, instance):
     352        return "InlineMultiline\ntest\nstring"
    350353
    351354
    352355class SubPostInline(admin.TabularInline):
  • tests/regressiontests/admin_views/tests.py

    diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
    index bbb8281..10f9461 100644
    a b class ReadonlyTest(TestCase): 
    31643164
    31653165        # Checks that multiline text in a readonly field gets <br /> tags
    31663166        self.assertContains(response, "Multiline<br />test<br />string")
     3167        self.assertContains(response, "InlineMultiline<br />test<br />string")
    31673168
    31683169        self.assertContains(response,
    31693170            formats.localize(datetime.date.today() - datetime.timedelta(days=7))
Back to Top