Advanced deprecation warnings for Django 1.9.

This commit is contained in:
Tim Graham 2015-01-19 12:22:41 -05:00
parent 33457cd3b0
commit 378a0d27d6
3 changed files with 6 additions and 7 deletions

View File

@ -25,7 +25,6 @@ from django.db.models.options import Options
from django.db.models.query import Q
from django.db.models.query_utils import DeferredAttribute, deferred_class_factory
from django.utils import six
from django.utils.deprecation import RemovedInDjango19Warning
from django.utils.encoding import force_str, force_text
from django.utils.functional import curry
from django.utils.six.moves import zip
@ -106,7 +105,7 @@ class ModelBase(type):
"This will no longer be supported in Django 1.9." %
(module, name))
if not abstract:
warnings.warn(msg, RemovedInDjango19Warning, stacklevel=2)
warnings.warn(msg, DeprecationWarning, stacklevel=2)
model_module = sys.modules[new_class.__module__]
package_components = model_module.__name__.split('.')

View File

@ -2,15 +2,15 @@ import inspect
import warnings
class RemovedInDjango20Warning(PendingDeprecationWarning):
class RemovedInDjango21Warning(PendingDeprecationWarning):
pass
class RemovedInDjango19Warning(DeprecationWarning):
class RemovedInDjango20Warning(DeprecationWarning):
pass
RemovedInNextVersionWarning = RemovedInDjango19Warning
RemovedInNextVersionWarning = RemovedInDjango20Warning
class warn_about_renamed_method(object):

View File

@ -15,13 +15,13 @@ from django.conf import settings
from django.db import connection
from django.test import TransactionTestCase, TestCase
from django.test.utils import get_runner
from django.utils.deprecation import RemovedInDjango19Warning, RemovedInDjango20Warning
from django.utils.deprecation import RemovedInDjango20Warning, RemovedInDjango21Warning
from django.utils._os import upath
from django.utils import six
warnings.simplefilter("error", RemovedInDjango19Warning)
warnings.simplefilter("error", RemovedInDjango20Warning)
warnings.simplefilter("error", RemovedInDjango21Warning)
CONTRIB_MODULE_PATH = 'django.contrib'