MCPcopy
hub / github.com/django/django / ResolvedOuterRef

Class ResolvedOuterRef

django/db/models/expressions.py:946–980  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

944
945
946class ResolvedOuterRef(F):
947 """
948 An object that contains a reference to an outer query.
949
950 In this case, the reference to the outer query has been resolved because
951 the inner query has been used as a subquery.
952 """
953
954 contains_aggregate = False
955 contains_over_clause = False
956
957 def as_sql(self, *args, **kwargs):
958 raise ValueError(
959 "This queryset contains a reference to an outer query and may "
960 "only be used in a subquery."
961 )
962
963 def resolve_expression(self, *args, **kwargs):
964 col = super().resolve_expression(*args, **kwargs)
965 if col.contains_over_clause:
966 raise NotSupportedError(
967 f"Referencing outer query window expression is not supported: "
968 f"{self.name}."
969 )
970 # FIXME: Rename possibly_multivalued to multivalued and fix detection
971 # for non-multivalued JOINs (e.g. foreign key fields). This should take
972 # into account only many-to-many and one-to-many relationships.
973 col.possibly_multivalued = LOOKUP_SEP in self.name
974 return col
975
976 def relabeled_clone(self, relabels):
977 return self
978
979 def get_group_by_cols(self):
980 return []
981
982
983class OuterRef(F):

Callers 2

split_excludeMethod · 0.90
resolve_expressionMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected