module documentation

The main QuerySet implementation. This provides the public API for the ORM.
Class ​Query​Set Represent a lazy database lookup for a set of objects.
Constant MAX​_GET​_RESULTS Undocumented
Constant REPR​_OUTPUT​_SIZE Undocumented
Class ​Base​Iterable Undocumented
Class ​Empty​Query​Set Marker class to checking if a queryset is empty by .none(): isinstance(qs.none(), EmptyQuerySet) -> True
Class ​Flat​Values​List​Iterable Iterable returned by QuerySet.values_list(flat=True) that yields single values.
Class ​Instance​Check​Meta Undocumented
Class ​Model​Iterable Iterable that yields a model instance for each row.
Class ​Named​Values​List​Iterable Iterable returned by QuerySet.values_list(named=True) that yields a namedtuple for each row.
Class ​Prefetch Undocumented
Class ​Raw​Query​Set Provide an iterator which converts the results of raw SQL queries into annotated model instances.
Class ​Related​Populator RelatedPopulator is used for select_related() object instantiation.
Class ​Values​Iterable Iterable returned by QuerySet.values() that yields a dict for each row.
Class ​Values​List​Iterable Iterable returned by QuerySet.values_list(flat=False) that yields a tuple for each row.
Function get​_prefetcher No summary
Function get​_related​_populators Undocumented
Function normalize​_prefetch​_lookups Normalize lookups into Prefetch objects.
Function prefetch​_one​_level Helper function for prefetch_related_objects().
Function prefetch​_related​_objects Populate prefetched object caches for a list of model instances based on the lookups/Prefetch instances given.
MAX_GET_RESULTS: int =

Undocumented

Value
21
REPR_OUTPUT_SIZE: int =

Undocumented

Value
20
def get_prefetcher(instance, through_attr, to_attr):

For the attribute 'through_attr' on the given instance, find an object that has a get_prefetch_queryset(). Return a 4 tuple containing: (the object with get_prefetch_queryset (or None),

the descriptor object representing this relationship (or None), a boolean that is False if the attribute was not found at all, a function that takes an instance and returns a boolean that is True if the attribute has already been fetched for that instance)
def get_related_populators(klass_info, select, db):

Undocumented

def normalize_prefetch_lookups(lookups, prefix=None):
Normalize lookups into Prefetch objects.
def prefetch_one_level(instances, prefetcher, lookup, level):

Helper function for prefetch_related_objects().

Run prefetches on all instances using the prefetcher object, assigning results to relevant caches in instance.

Return the prefetched objects along with any additional prefetches that must be done due to prefetch_related lookups found from default managers.

def prefetch_related_objects(model_instances, *related_lookups):
Populate prefetched object caches for a list of model instances based on the lookups/Prefetch instances given.