From 68e3ca13d771a8f08a8d1c272308cd44b4dcfa76 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Thu, 7 Jan 2021 20:56:49 +0100 Subject: Refs #30988 -- Removed InvalidQuery exception per deprecation timeline. --- django/db/models/query_utils.py | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) (limited to 'django/db/models/query_utils.py') diff --git a/django/db/models/query_utils.py b/django/db/models/query_utils.py index f7c6d74e72..c2623f099f 100644 --- a/django/db/models/query_utils.py +++ b/django/db/models/query_utils.py @@ -8,13 +8,11 @@ circular import difficulties. import copy import functools import inspect -import warnings from collections import namedtuple -from django.core.exceptions import FieldDoesNotExist, FieldError +from django.core.exceptions import FieldError from django.db.models.constants import LOOKUP_SEP from django.utils import tree -from django.utils.deprecation import RemovedInDjango40Warning # PathInfo is used when converting lookups (fk__somecol). The contents # describe the relation in Model terms (model Options and Fields for both @@ -22,32 +20,6 @@ from django.utils.deprecation import RemovedInDjango40Warning PathInfo = namedtuple('PathInfo', 'from_opts to_opts target_fields join_field m2m direct filtered_relation') -class InvalidQueryType(type): - @property - def _subclasses(self): - return (FieldDoesNotExist, FieldError) - - def __warn(self): - warnings.warn( - 'The InvalidQuery exception class is deprecated. Use ' - 'FieldDoesNotExist or FieldError instead.', - category=RemovedInDjango40Warning, - stacklevel=4, - ) - - def __instancecheck__(self, instance): - self.__warn() - return isinstance(instance, self._subclasses) or super().__instancecheck__(instance) - - def __subclasscheck__(self, subclass): - self.__warn() - return issubclass(subclass, self._subclasses) or super().__subclasscheck__(subclass) - - -class InvalidQuery(Exception, metaclass=InvalidQueryType): - pass - - def subclasses(cls): yield cls for subclass in cls.__subclasses__(): -- cgit v1.3