diff --git a/tests/modeltests/validation/models.py b/tests/modeltests/validation/models.py index 2d160ed4f1..49bf4a154d 100644 --- a/tests/modeltests/validation/models.py +++ b/tests/modeltests/validation/models.py @@ -81,7 +81,8 @@ class FlexibleDatePost(models.Model): class UniqueErrorsModel(models.Model): name = models.CharField(max_length=100, unique=True, error_messages={'unique': u'Custom unique name message.'}) - number = models.IntegerField(unique=True, error_messages={'unique': u'Custom unique number message.'}) + #number = models.IntegerField(unique=True, error_messages={'unique': u'Custom unique number message.'}) + no = models.IntegerField(unique=True, error_messages={'unique': u'Custom unique number message.'}) class GenericIPAddressTestModel(models.Model): generic_ip = models.GenericIPAddressField(blank=True, null=True, unique=True) diff --git a/tests/modeltests/validation/test_unique.py b/tests/modeltests/validation/test_unique.py index f891b5740e..176a5dba96 100644 --- a/tests/modeltests/validation/test_unique.py +++ b/tests/modeltests/validation/test_unique.py @@ -135,14 +135,14 @@ class PerformUniqueChecksTest(TestCase): self.fail("unique_for_month checks shouldn't trigger when the associated DateField is None.") def test_unique_errors(self): - m1 = UniqueErrorsModel.objects.create(name='Some Name', number=10) - m = UniqueErrorsModel(name='Some Name', number=11) + m1 = UniqueErrorsModel.objects.create(name='Some Name', no=10) + m = UniqueErrorsModel(name='Some Name', no=11) with self.assertRaises(ValidationError) as cm: m.full_clean() self.assertEqual(cm.exception.message_dict, {'name': [u'Custom unique name message.']}) - m = UniqueErrorsModel(name='Some Other Name', number=10) + m = UniqueErrorsModel(name='Some Other Name', no=10) with self.assertRaises(ValidationError) as cm: m.full_clean() - self.assertEqual(cm.exception.message_dict, {'number': [u'Custom unique number message.']}) + self.assertEqual(cm.exception.message_dict, {'no': [u'Custom unique number message.']})