1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

Fixed #33547 -- Fixed error when rendering invalid inlines with readonly fields in admin.

Regression in de95c82667.

Thanks David Glenck for the report.
This commit is contained in:
Mariusz Felisiak
2022-03-01 08:09:58 +01:00
committed by GitHub
parent 119f227aa6
commit 445b075def
4 changed files with 29 additions and 1 deletions

View File

@@ -241,6 +241,22 @@ class TestInline(TestDataMixin, TestCase):
# column cells
self.assertContains(response, "<p>Callable in QuestionInline</p>")
def test_model_error_inline_with_readonly_field(self):
poll = Poll.objects.create(name="Test poll")
data = {
"question_set-TOTAL_FORMS": 1,
"question_set-INITIAL_FORMS": 0,
"question_set-MAX_NUM_FORMS": 0,
"_save": "Save",
"question_set-0-text": "Question",
"question_set-0-poll": poll.pk,
}
response = self.client.post(
reverse("admin:admin_inlines_poll_change", args=(poll.pk,)),
data,
)
self.assertContains(response, "Always invalid model.")
def test_help_text(self):
"""
The inlines' model field help texts are displayed when using both the