class FilteredRelation
from django.db.models.query_utils import FilteredRelation
Specify custom filtering in the ON clause of SQL joins.
Ancestors (MRO)
- builtins.object
- django.db.models.query_utils.FilteredRelation
def as_sql(self, compiler, connection)
django.db.models.query_utils.FilteredRelation
def as_sql(self, compiler, connection):
return compiler.compile(self.resolved_condition)
def clone(self)
django.db.models.query_utils.FilteredRelation
def clone(self):
clone = FilteredRelation(self.relation_name, condition=self.condition)
clone.alias = self.alias
if (resolved_condition := self.resolved_condition) is not None:
clone.resolved_condition = resolved_condition.clone()
return clone
def relabeled_clone(self, change_map)
django.db.models.query_utils.FilteredRelation
def relabeled_clone(self, change_map):
clone = self.clone()
if resolved_condition := clone.resolved_condition:
clone.resolved_condition = resolved_condition.relabeled_clone(change_map)
return clone
def resolve_expression(self, query, reuse, *args, **kwargs)
django.db.models.query_utils.FilteredRelation
def resolve_expression(self, query, reuse, *args, **kwargs):
clone = self.clone()
clone.resolved_condition = query.build_filter(
self.condition,
can_reuse=reuse,
allow_joins=True,
split_subq=False,
update_join_types=False,
)[0]
return clone