mirror of
https://github.com/django/django.git
synced 2025-07-24 05:36:15 +00:00
Fixed #22935 -- Changed ForeignKey.default_error_messages['invalid'] to refer to correct field.
Thanks Tim Graham for suggestion and review.
This commit is contained in:
parent
27ee608b55
commit
10e83d48a3
4 changed files with 19 additions and 3 deletions
|
@ -25,7 +25,12 @@ class BaseModelValidationTests(ValidationTestCase):
|
|||
|
||||
def test_wrong_FK_value_raises_error(self):
|
||||
mtv = ModelToValidate(number=10, name='Some Name', parent_id=3)
|
||||
self.assertFailsValidation(mtv.full_clean, ['parent'])
|
||||
self.assertFieldFailsValidationWithMessage(mtv.full_clean, 'parent',
|
||||
['model to validate instance with id %r does not exist.' % 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])
|
||||
|
||||
def test_correct_FK_value_validates(self):
|
||||
parent = ModelToValidate.objects.create(number=10, name='Some Name')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue