diff options
| author | Claude Paroz <claude@2xlibre.net> | 2012-09-01 18:32:27 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2012-09-01 18:39:51 +0200 |
| commit | 92f7af3c36ec62e0b55c69ae8e359e53c8cfec15 (patch) | |
| tree | 88408a89339382163cb3522a5bafd8bc8a19e008 /django | |
| parent | c2f1aa5a3c605927f1fb86c0d4eaa9f9067a0313 (diff) | |
[1.4.x] Fixed #18212 -- Standardized arguments of GenericIPAddressField
Unlike other model fields, the newly introduced (1.4)
GenericIPAddressField did not accept verbose_name and name as the
first positional arguments. This commit fixes it.
Thanks Dan McGee for the report and the patch.
Backport of 306d34873cff2 from master.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/fields/__init__.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index 22546c27de..527a3c0b0e 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -1023,13 +1023,14 @@ class GenericIPAddressField(Field): description = _("IP address") default_error_messages = {} - def __init__(self, protocol='both', unpack_ipv4=False, *args, **kwargs): + def __init__(self, verbose_name=None, name=None, protocol='both', + unpack_ipv4=False, *args, **kwargs): self.unpack_ipv4 = unpack_ipv4 self.default_validators, invalid_error_message = \ validators.ip_address_validators(protocol, unpack_ipv4) self.default_error_messages['invalid'] = invalid_error_message kwargs['max_length'] = 39 - Field.__init__(self, *args, **kwargs) + Field.__init__(self, verbose_name, name, *args, **kwargs) def get_internal_type(self): return "GenericIPAddressField" |
