1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #27386 -- Wrapped admin's readonly fields in <div> rather than <p>.

This commit is contained in:
Jacob Rief
2016-11-05 12:47:12 +01:00
committed by Tim Graham
parent a17fe73d2d
commit b3162cab94
5 changed files with 24 additions and 12 deletions

View File

@@ -4598,11 +4598,15 @@ class ReadonlyTest(AdminFieldExtractionMixin, TestCase):
self.assertContains(response, "foo")
# Multiline text in a readonly field gets <br /> tags
self.assertContains(response, "Multiline<br />test<br />string")
self.assertContains(response, "<p>Multiline<br />html<br />content</p>", html=True)
self.assertContains(response, "InlineMultiline<br />test<br />string")
self.assertContains(response, 'Multiline<br />test<br />string')
self.assertContains(response, '<div class="readonly">Multiline<br />html<br />content</div>', html=True)
self.assertContains(response, 'InlineMultiline<br />test<br />string')
# Remove only this last line when the deprecation completes.
self.assertContains(response, "<p>Multiline<br />html<br />content<br />with allow tags</p>", html=True)
self.assertContains(
response,
'<div class="readonly">Multiline<br />html<br />content<br />with allow tags</div>',
html=True
)
self.assertContains(response, formats.localize(datetime.date.today() - datetime.timedelta(days=7)))
@@ -4685,8 +4689,7 @@ class ReadonlyTest(AdminFieldExtractionMixin, TestCase):
"""
choice = Choice.objects.create(choice=None)
response = self.client.get(reverse('admin:admin_views_choice_change', args=(choice.pk,)))
self.assertContains(response, '<p>No opinion</p>', html=True)
self.assertNotContains(response, '<p>(None)</p>')
self.assertContains(response, '<div class="readonly">No opinion</div>', html=True)
def test_readonly_manytomany_backwards_ref(self):
"""
@@ -4705,7 +4708,7 @@ class ReadonlyTest(AdminFieldExtractionMixin, TestCase):
pizza.toppings.add(topping)
response = self.client.get(reverse('admin:admin_views_pizza_change', args=(pizza.pk,)))
self.assertContains(response, '<label>Toppings:</label>', html=True)
self.assertContains(response, '<p>Salami</p>', html=True)
self.assertContains(response, '<div class="readonly">Salami</div>', html=True)
def test_readonly_onetoone_backwards_ref(self):
"""