summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/deprecation.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/django/utils/deprecation.py b/django/utils/deprecation.py
index 33c384d1f8..905bbc4f6d 100644
--- a/django/utils/deprecation.py
+++ b/django/utils/deprecation.py
@@ -8,7 +8,8 @@ class RemovedInDjango20Warning(PendingDeprecationWarning):
pass
-RemovedInNextVersionWarning = DeprecationWarning
+class RemovedInNextVersionWarning(DeprecationWarning):
+ pass
class warn_about_renamed_method(object):
@@ -69,3 +70,12 @@ class RenameMethodsBase(type):
setattr(base, old_method_name, wrapper(new_method))
return new_class
+
+
+class DeprecationInstanceCheck(type):
+ def __instancecheck__(self, instance):
+ warnings.warn(
+ "`%s` is deprecated, use `%s` instead." % (self.__name__, self.alternative),
+ self.deprecation_warning, 2
+ )
+ return super(DeprecationInstanceCheck, self).__instancecheck__(instance)