module documentation

Various data structures used in query construction.

Factored out from django.db.models.query to avoid making the main module very large and/or so that they can be used by other modules without getting into circular import difficulties.

Variable ​Path​Info Undocumented
Class ​Deferred​Attribute A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Class ​Filtered​Relation Specify custom filtering in the ON clause of SQL joins.
Class Q Encapsulate filters as objects that can then be combined logically (using & and |).
Class ​Register​Lookup​Mixin No class docstring; 0/2 method, 1/1 static method, 1/5 class method documented
Function check​_rel​_lookup​_compatibility No summary
Function refs​_expression Check if the lookup_parts contains references to the given annotations set. Because the LOOKUP_SEP is contained in the default annotation names, check each prefix of the lookup_parts for a match.
Function select​_related​_descend No summary
Function subclasses Undocumented
PathInfo =

Undocumented

def check_rel_lookup_compatibility(model, target_opts, field):

Check that self.model is compatible with target_opts. Compatibility is OK if:

  1. model and opts match (where proxy inheritance is removed)
  2. model is parent of opts' model or the other way around
def refs_expression(lookup_parts, annotations):
Check if the lookup_parts contains references to the given annotations set. Because the LOOKUP_SEP is contained in the default annotation names, check each prefix of the lookup_parts for a match.
def select_related_descend(field, restricted, requested, load_fields, reverse=False):

Return True if this field should be used to descend deeper for select_related() purposes. Used by both the query construction code (sql.query.fill_related_selections()) and the model instance creation code (query.get_klass_info()).

Arguments:
  • field - the field to be checked
  • restricted - a boolean field, indicating if the field list has been manually restricted using a requested clause)
  • requested - The select_related() dictionary.
  • load_fields - the set of fields to be loaded on this model
  • reverse - boolean, True if we are checking a reverse select related
def subclasses(cls):

Undocumented