module documentation

Create SQL statements for QuerySets.

The code in here encapsulates all of the SQL construction so that QuerySets themselves do not have to (and could be backed by things other than SQL databases). The abstraction barrier only works one way: this module has to know all about the internals of models in order to get the information it needs.

Variable ​Explain​Info Undocumented
Variable ​Join​Info Undocumented
Class ​Join​Promoter A class to abstract away join promotion problems for complex filter conditions.
Class ​Query A single SQL query.
Class ​Raw​Query A single raw SQL query.
Function add​_to​_dict Add "value" to the set of values for "key", whether or not "key" already exists.
Function get​_children​_from​_q Undocumented
Function get​_field​_names​_from​_opts Undocumented
Function get​_order​_dir Return the field name and direction for an order specification. For example, '-foo' is returned as ('foo', 'DESC').
Function is​_reverse​_o2o Check if the given field is reverse-o2o. The field is expected to be some sort of relation field or related object.
ExplainInfo =

Undocumented

JoinInfo =

Undocumented

def add_to_dict(data, key, value):
Add "value" to the set of values for "key", whether or not "key" already exists.
def get_children_from_q(q):

Undocumented

def get_field_names_from_opts(opts):

Undocumented

def get_order_dir(field, default='ASC'):

Return the field name and direction for an order specification. For example, '-foo' is returned as ('foo', 'DESC').

The 'default' param is used to indicate which way no prefix (or a '+' prefix) should sort. The '-' prefix always sorts the opposite way.

def is_reverse_o2o(field):
Check if the given field is reverse-o2o. The field is expected to be some sort of relation field or related object.