mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #16986 -- Model.clean() can report errors on individual fields.
This commit provides the tests for this issue but the actual problem was solved by the ValidationError refactor inf34cfecandee77d4b. Refs #20199.
This commit is contained in:
@@ -1782,6 +1782,14 @@ class OldFormForXTests(TestCase):
|
||||
'<ul class="errorlist"><li>Model custom error message.</li></ul>'
|
||||
)
|
||||
|
||||
def test_model_clean_error_messages(self) :
|
||||
data = {'name1': 'FORBIDDEN_VALUE', 'name2': 'ABC'}
|
||||
errors = CustomErrorMessageForm(data).errors
|
||||
self.assertHTMLEqual(
|
||||
str(errors['name1']),
|
||||
'<ul class="errorlist"><li>Model.clean() error messages.</li></ul>'
|
||||
)
|
||||
|
||||
|
||||
class M2mHelpTextTest(TestCase):
|
||||
"""Tests for ticket #9321."""
|
||||
|
||||
Reference in New Issue
Block a user