1
0
mirror of https://github.com/django/django.git synced 2025-10-27 07:36:08 +00:00

Fixed #20439 -- Started deprecation of IPAddressField

This commit is contained in:
Erik Romijn
2013-09-28 10:22:46 +02:00
committed by Aymeric Augustin
parent 8f51ba669a
commit 1a63092981
14 changed files with 68 additions and 12 deletions

View File

@@ -1312,6 +1312,8 @@ class IPAddressField(Field):
description = _("IPv4 address")
def __init__(self, *args, **kwargs):
warnings.warn("IPAddressField has been deprecated. Use GenericIPAddressField instead.",
PendingDeprecationWarning)
kwargs['max_length'] = 15
Field.__init__(self, *args, **kwargs)

View File

@@ -9,6 +9,7 @@ import datetime
import os
import re
import sys
import warnings
from decimal import Decimal, DecimalException
from io import BytesIO
@@ -1144,6 +1145,11 @@ class SplitDateTimeField(MultiValueField):
class IPAddressField(CharField):
default_validators = [validators.validate_ipv4_address]
def __init__(self, *args, **kwargs):
warnings.warn("IPAddressField has been deprecated. Use GenericIPAddressField instead.",
PendingDeprecationWarning)
super(IPAddressField, self).__init__(*args, **kwargs)
def to_python(self, value):
if value in self.empty_values:
return ''