summaryrefslogtreecommitdiff
path: root/tests/forms_tests
diff options
context:
space:
mode:
authorAdam Johnson <me@adamj.eu>2024-12-09 11:17:25 +0000
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-12-10 12:13:43 +0100
commit02628c051c18d000256424daffe996c22bed5ae3 (patch)
tree03d57b02488081d0220fb6bbfe4d72414b914f76 /tests/forms_tests
parent1860a1afc9ac20750f932e8e0a94b32d096f2848 (diff)
Fixed #35988 -- Made BaseForm.full_clean() pass renderer to ErrorDict.
Diffstat (limited to 'tests/forms_tests')
-rw-r--r--tests/forms_tests/tests/test_forms.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py
index cd909628cb..d88ac33f24 100644
--- a/tests/forms_tests/tests/test_forms.py
+++ b/tests/forms_tests/tests/test_forms.py
@@ -5313,6 +5313,22 @@ class OverrideTests(SimpleTestCase):
"required></p>",
)
+ def test_custom_renderer_error_dict(self):
+ class CustomRenderer(DjangoTemplates):
+ def render(self, template_name, context, request=None):
+ if template_name == "django/forms/errors/dict/default.html":
+ return "<strong>So many errors!</strong>"
+ return super().render(template_name, context, request)
+
+ form = Form({}, renderer=CustomRenderer())
+ form.full_clean()
+ form.add_error(None, "Test error")
+
+ self.assertHTMLEqual(
+ form.errors.render(),
+ "<strong>So many errors!</strong>",
+ )
+
def test_cyclic_context_boundfield_render(self):
class FirstNameForm(Form):
first_name = CharField()