1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +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

@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import warnings
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@@ -49,7 +50,9 @@ class Base(models.Model):
class Article(models.Model):
name = models.CharField(max_length=50)
text = models.TextField()
submitted_from = models.IPAddressField(blank=True, null=True)
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
submitted_from = models.IPAddressField(blank=True, null=True)
def __str__(self):
return "Article %s" % self.name