mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Fixed #23396 -- Ensured ValueQuerySets are not checked by check_related_objects.
This commit is contained in:
parent
3a34e45fdb
commit
0e16c3e3cd
3 changed files with 35 additions and 15 deletions
|
@ -1052,6 +1052,15 @@ class QuerySet(object):
|
|||
"""
|
||||
return self.query.has_filters()
|
||||
|
||||
def is_compatible_query_object_type(self, opts):
|
||||
model = self.model
|
||||
return (
|
||||
model == opts.concrete_model or
|
||||
opts.concrete_model in model._meta.get_parent_list() or
|
||||
model in opts.get_parent_list()
|
||||
)
|
||||
is_compatible_query_object_type.queryset_only = True
|
||||
|
||||
|
||||
class InstanceCheckMeta(type):
|
||||
def __instancecheck__(self, instance):
|
||||
|
@ -1209,6 +1218,13 @@ class ValuesQuerySet(QuerySet):
|
|||
% self.__class__.__name__)
|
||||
return self
|
||||
|
||||
def is_compatible_query_object_type(self, opts):
|
||||
"""
|
||||
ValueQuerySets do not need to be checked for compatibility.
|
||||
We trust that users of ValueQuerySets know what they are doing.
|
||||
"""
|
||||
return True
|
||||
|
||||
|
||||
class ValuesListQuerySet(ValuesQuerySet):
|
||||
def iterator(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue