Advanced deprecation warnings for Django 1.9.
This commit is contained in:
parent
33457cd3b0
commit
378a0d27d6
|
@ -25,7 +25,6 @@ from django.db.models.options import Options
|
||||||
from django.db.models.query import Q
|
from django.db.models.query import Q
|
||||||
from django.db.models.query_utils import DeferredAttribute, deferred_class_factory
|
from django.db.models.query_utils import DeferredAttribute, deferred_class_factory
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
from django.utils.deprecation import RemovedInDjango19Warning
|
|
||||||
from django.utils.encoding import force_str, force_text
|
from django.utils.encoding import force_str, force_text
|
||||||
from django.utils.functional import curry
|
from django.utils.functional import curry
|
||||||
from django.utils.six.moves import zip
|
from django.utils.six.moves import zip
|
||||||
|
@ -106,7 +105,7 @@ class ModelBase(type):
|
||||||
"This will no longer be supported in Django 1.9." %
|
"This will no longer be supported in Django 1.9." %
|
||||||
(module, name))
|
(module, name))
|
||||||
if not abstract:
|
if not abstract:
|
||||||
warnings.warn(msg, RemovedInDjango19Warning, stacklevel=2)
|
warnings.warn(msg, DeprecationWarning, stacklevel=2)
|
||||||
|
|
||||||
model_module = sys.modules[new_class.__module__]
|
model_module = sys.modules[new_class.__module__]
|
||||||
package_components = model_module.__name__.split('.')
|
package_components = model_module.__name__.split('.')
|
||||||
|
|
|
@ -2,15 +2,15 @@ import inspect
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
|
|
||||||
class RemovedInDjango20Warning(PendingDeprecationWarning):
|
class RemovedInDjango21Warning(PendingDeprecationWarning):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class RemovedInDjango19Warning(DeprecationWarning):
|
class RemovedInDjango20Warning(DeprecationWarning):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
RemovedInNextVersionWarning = RemovedInDjango19Warning
|
RemovedInNextVersionWarning = RemovedInDjango20Warning
|
||||||
|
|
||||||
|
|
||||||
class warn_about_renamed_method(object):
|
class warn_about_renamed_method(object):
|
||||||
|
|
|
@ -15,13 +15,13 @@ from django.conf import settings
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
from django.test import TransactionTestCase, TestCase
|
from django.test import TransactionTestCase, TestCase
|
||||||
from django.test.utils import get_runner
|
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._os import upath
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
|
|
||||||
|
|
||||||
warnings.simplefilter("error", RemovedInDjango19Warning)
|
|
||||||
warnings.simplefilter("error", RemovedInDjango20Warning)
|
warnings.simplefilter("error", RemovedInDjango20Warning)
|
||||||
|
warnings.simplefilter("error", RemovedInDjango21Warning)
|
||||||
|
|
||||||
CONTRIB_MODULE_PATH = 'django.contrib'
|
CONTRIB_MODULE_PATH = 'django.contrib'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue