diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index 22123467cd..0b5e7d4782 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -1131,6 +1131,7 @@ class GenericIPAddressField(Field): def __init__(self, verbose_name=None, name=None, protocol='both', unpack_ipv4=False, *args, **kwargs): self.unpack_ipv4 = unpack_ipv4 + self.protocol = protocol self.default_validators, invalid_error_message = \ validators.ip_address_validators(protocol, unpack_ipv4) self.default_error_messages['invalid'] = invalid_error_message