diff --git a/tests/modeltests/validation/models.py b/tests/modeltests/validation/models.py
a
|
b
|
|
84 | 84 | number = models.IntegerField(unique=True, error_messages={'unique': u'Custom unique number message.'}) |
85 | 85 | |
86 | 86 | class GenericIPAddressTestModel(models.Model): |
87 | | generic_ip = models.GenericIPAddressField(blank=True, unique=True) |
88 | | v4_ip = models.GenericIPAddressField(blank=True, protocol="ipv4") |
89 | | v6_ip = models.GenericIPAddressField(blank=True, protocol="ipv6") |
| 87 | generic_ip = models.GenericIPAddressField(null=True, blank=True, unique=True) |
| 88 | v4_ip = models.GenericIPAddressField(null=True, blank=True, protocol="ipv4") |
| 89 | v6_ip = models.GenericIPAddressField(null=True, blank=True, protocol="ipv6") |
90 | 90 | |
91 | | class GenericIPAddressWithUnpackUniqueTestModel(models.Model): |
92 | | generic_v4unpack_ip = models.GenericIPAddressField(blank=True, unique=True, unpack_ipv4=True) |
| 91 | class GenericIPAddrUnpackUniqueModel(models.Model): |
| 92 | generic_v4unpack_ip = models.GenericIPAddressField(null=True, blank=True, unique=True, unpack_ipv4=True) |
diff --git a/tests/modeltests/validation/tests.py b/tests/modeltests/validation/tests.py
a
|
b
|
|
3 | 3 | from django.core.exceptions import NON_FIELD_ERRORS |
4 | 4 | from modeltests.validation import ValidationTestCase |
5 | 5 | from modeltests.validation.models import (Author, Article, ModelToValidate, |
6 | | GenericIPAddressTestModel, GenericIPAddressWithUnpackUniqueTestModel) |
| 6 | GenericIPAddressTestModel, GenericIPAddrUnpackUniqueModel) |
7 | 7 | |
8 | 8 | # Import other tests for this package. |
9 | 9 | from modeltests.validation.validators import TestModelsWithValidators |
… |
… |
|
177 | 177 | self.assertEqual(None, giptm.full_clean()) |
178 | 178 | |
179 | 179 | # These two are the same, because we are doing IPv4 unpacking |
180 | | giptm = GenericIPAddressWithUnpackUniqueTestModel(generic_v4unpack_ip="::ffff:18.52.18.52") |
| 180 | giptm = GenericIPAddrUnpackUniqueModel(generic_v4unpack_ip="::ffff:18.52.18.52") |
181 | 181 | giptm.save() |
182 | | giptm = GenericIPAddressWithUnpackUniqueTestModel(generic_v4unpack_ip="18.52.18.52") |
| 182 | giptm = GenericIPAddrUnpackUniqueModel(generic_v4unpack_ip="18.52.18.52") |
183 | 183 | self.assertFailsValidation(giptm.full_clean, ['generic_v4unpack_ip',]) |
diff --git a/tests/regressiontests/forms/tests/extra.py b/tests/regressiontests/forms/tests/extra.py
a
|
b
|
|
495 | 495 | self.assertFormErrors([u'Enter a valid IPv4 address.'], f.clean, 'fe80::223:6cff:fe8a:2e8a') |
496 | 496 | self.assertFormErrors([u'Enter a valid IPv4 address.'], f.clean, '2a02::223:6cff:fe8a:2e8a') |
497 | 497 | |
498 | | def test_generic_ipaddress_as_ipv4_only(self): |
| 498 | def test_generic_ipaddress_as_ipv6_only(self): |
499 | 499 | f = GenericIPAddressField(protocol="IPv6") |
500 | 500 | self.assertFormErrors([u'This field is required.'], f.clean, '') |
501 | 501 | self.assertFormErrors([u'This field is required.'], f.clean, None) |