class Prefetch

from django.db.models.query import Prefetch


  

Ancestors (MRO)

  1. builtins.object
  2. django.db.models.query.Prefetch
def add_prefix(self, prefix)
django.db.models.query.Prefetch
    def add_prefix(self, prefix):
        self.prefetch_through = prefix + LOOKUP_SEP + self.prefetch_through
        self.prefetch_to = prefix + LOOKUP_SEP + self.prefetch_to
def get_current_prefetch_to(self, level)
django.db.models.query.Prefetch
    def get_current_prefetch_to(self, level):
        return LOOKUP_SEP.join(self.prefetch_to.split(LOOKUP_SEP)[: level + 1])
def get_current_queryset(self, level)
django.db.models.query.Prefetch
    def get_current_queryset(self, level):
        warnings.warn(
            "Prefetch.get_current_queryset() is deprecated. Use "
            "get_current_querysets() instead.",
            RemovedInDjango60Warning,
            stacklevel=2,
        )
        querysets = self.get_current_querysets(level)
        return querysets[0] if querysets is not None else None
def get_current_querysets(self, level)
django.db.models.query.Prefetch
    def get_current_querysets(self, level):
        if (
            self.get_current_prefetch_to(level) == self.prefetch_to
            and self.queryset is not None
        ):
            return [self.queryset]
        return None
def get_current_to_attr(self, level)
django.db.models.query.Prefetch
    def get_current_to_attr(self, level):
        parts = self.prefetch_to.split(LOOKUP_SEP)
        to_attr = parts[level]
        as_attr = self.to_attr and level == len(parts) - 1
        return to_attr, as_attr