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

Fixed #35569 -- Improved wording of invalid ForeignKey error message.

This commit is contained in:
Jacob Walls
2024-07-03 07:51:50 -04:00
committed by Sarah Boyce
parent 704192e478
commit 31837dbcb3
3 changed files with 13 additions and 8 deletions

View File

@@ -31,15 +31,18 @@ class BaseModelValidationTests(ValidationAssertions, TestCase):
self.assertFieldFailsValidationWithMessage(
mtv.full_clean,
"parent",
["model to validate instance with id %r does not exist." % mtv.parent_id],
[
"model to validate instance with id %r is not a valid choice."
% mtv.parent_id
],
)
mtv = ModelToValidate(number=10, name="Some Name", ufm_id="Some Name")
self.assertFieldFailsValidationWithMessage(
mtv.full_clean,
"ufm",
[
"unique fields model instance with unique_charfield %r does not exist."
% mtv.name
"unique fields model instance with unique_charfield %r is not "
"a valid choice." % mtv.name
],
)