class ResolvedOuterRef
from django.db.models.expressions import ResolvedOuterRef
An object that contains a reference to an outer query. In this case, the reference to the outer query has been resolved because the inner query has been used as a subquery.
Ancestors (MRO)
- builtins.object
- django.db.models.expressions.Combinable
- django.db.models.expressions.F
- django.db.models.expressions.ResolvedOuterRef
Attribute | Value | Defined in |
---|---|---|
ADD |
+ |
django.db.models.expressions.Combinable |
BITAND |
& |
django.db.models.expressions.Combinable |
BITLEFTSHIFT |
<< |
django.db.models.expressions.Combinable |
BITOR |
| |
django.db.models.expressions.Combinable |
BITRIGHTSHIFT |
>> |
django.db.models.expressions.Combinable |
BITXOR |
# |
django.db.models.expressions.Combinable |
DIV |
/ |
django.db.models.expressions.Combinable |
MOD |
%% |
django.db.models.expressions.Combinable |
MUL |
* |
django.db.models.expressions.Combinable |
POW |
^ |
django.db.models.expressions.Combinable |
SUB |
- |
django.db.models.expressions.Combinable |
allowed_default |
False |
django.db.models.expressions.F |
contains_aggregate |
False |
django.db.models.expressions.ResolvedOuterRef |
contains_over_clause |
False |
django.db.models.expressions.ResolvedOuterRef |
def as_sql(self, *args, **kwargs)
django.db.models.expressions.ResolvedOuterRef
def as_sql(self, *args, **kwargs):
raise ValueError(
"This queryset contains a reference to an outer query and may "
"only be used in a subquery."
)
def asc(self, **kwargs)
django.db.models.expressions.F
def asc(self, **kwargs):
return OrderBy(self, **kwargs)
def bitand(self, other)
django.db.models.expressions.Combinable
def bitand(self, other):
return self._combine(other, self.BITAND, False)
def bitleftshift(self, other)
django.db.models.expressions.Combinable
def bitleftshift(self, other):
return self._combine(other, self.BITLEFTSHIFT, False)
def bitor(self, other)
django.db.models.expressions.Combinable
def bitor(self, other):
return self._combine(other, self.BITOR, False)
def bitrightshift(self, other)
django.db.models.expressions.Combinable
def bitrightshift(self, other):
return self._combine(other, self.BITRIGHTSHIFT, False)
def bitxor(self, other)
django.db.models.expressions.Combinable
def bitxor(self, other):
return self._combine(other, self.BITXOR, False)
def copy(self)
django.db.models.expressions.F
def copy(self):
return copy.copy(self)
def deconstruct(obj)
django.db.models.expressions.F
Return a 3-tuple of class import path, positional arguments, and keyword arguments.
def deconstruct(obj):
"""
Return a 3-tuple of class import path, positional arguments,
and keyword arguments.
"""
# Fallback version
if path and type(obj) is klass:
module_name, _, name = path.rpartition(".")
else:
module_name = obj.__module__
name = obj.__class__.__name__
# Make sure it's actually there and not an inner class
module = import_module(module_name)
if not hasattr(module, name):
raise ValueError(
"Could not find object %s in %s.\n"
"Please note that you cannot serialize things like inner "
"classes. Please move the object into the main module "
"body to use migrations.\n"
"For more information, see "
"https://docs.djangoproject.com/en/%s/topics/migrations/"
"#serializing-values" % (name, module_name, get_docs_version())
)
return (
(
path
if path and type(obj) is klass
else f"{obj.__class__.__module__}.{name}"
),
obj._constructor_args[0],
obj._constructor_args[1],
)
def desc(self, **kwargs)
django.db.models.expressions.F
def desc(self, **kwargs):
return OrderBy(self, descending=True, **kwargs)
def get_group_by_cols(self)
django.db.models.expressions.ResolvedOuterRef
def get_group_by_cols(self):
return []
def relabeled_clone(self, relabels)
django.db.models.expressions.ResolvedOuterRef
def relabeled_clone(self, relabels):
return self
def replace_expressions(self, replacements)
django.db.models.expressions.F
def replace_expressions(self, replacements):
return replacements.get(self, self)
def resolve_expression(self, *args, **kwargs)
django.db.models.expressions.ResolvedOuterRef
django.db.models.expressions.ResolvedOuterRef
def resolve_expression(self, *args, **kwargs):
col = super().resolve_expression(*args, **kwargs)
if col.contains_over_clause:
raise NotSupportedError(
f"Referencing outer query window expression is not supported: "
f"{self.name}."
)
# FIXME: Rename possibly_multivalued to multivalued and fix detection
# for non-multivalued JOINs (e.g. foreign key fields). This should take
# into account only many-to-many and one-to-many relationships.
col.possibly_multivalued = LOOKUP_SEP in self.name
return col
django.db.models.expressions.F
def resolve_expression(
self, query=None, allow_joins=True, reuse=None, summarize=False, for_save=False
):
return query.resolve_ref(self.name, allow_joins, reuse, summarize)