1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Corrected deprecation warning silencing of SubfieldBase.

This commit is contained in:
Tim Graham 2014-09-05 09:12:14 -04:00
parent 344f37718b
commit f8bb8436e5
2 changed files with 10 additions and 12 deletions

View File

@ -1,13 +1,23 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import json import json
import warnings
from django.db import models from django.db import models
from django.utils.encoding import force_text from django.utils.encoding import force_text
from django.utils import six from django.utils import six
from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.encoding import python_2_unicode_compatible from django.utils.encoding import python_2_unicode_compatible
# Catch warning about subfieldbase -- remove in Django 2.0
warnings.filterwarnings(
'ignore',
'SubfieldBase has been deprecated. Use Field.from_db_value instead.',
RemovedInDjango20Warning
)
@python_2_unicode_compatible @python_2_unicode_compatible
class Small(object): class Small(object):
""" """

View File

@ -1,25 +1,13 @@
""" """
Tests for field subclassing. Tests for field subclassing.
""" """
import warnings
from django.db import models from django.db import models
from django.utils.encoding import force_text from django.utils.encoding import force_text
from django.utils.deprecation import RemovedInDjango20Warning
from .fields import Small, SmallField, SmallerField, JSONField from .fields import Small, SmallField, SmallerField, JSONField
from django.utils.encoding import python_2_unicode_compatible from django.utils.encoding import python_2_unicode_compatible
# Catch warning about subfieldbase -- remove in Django 2.0
warnings.filterwarnings(
'ignore',
'SubfieldBase has been deprecated. Use Field.from_db_value instead.',
RemovedInDjango20Warning
)
@python_2_unicode_compatible @python_2_unicode_compatible
class MyModel(models.Model): class MyModel(models.Model):
name = models.CharField(max_length=10) name = models.CharField(max_length=10)