class Lookup [source]
A Lookup is a generic class to implement lookups. A lookup is a query expression with a left-hand side, lhs; a right-hand side, rhs; and a lookup_name that is used to produce a boolean comparison between lhs and rhs such as lhs in rhs or lhs > rhs.
The notation to use a lookup in an expression is <lhs>__<lookup_name>=<rhs>.
This class doesn’t follow the Query Expression API since it has =<rhs> on its construction: lookups are always the end of a lookup expression.
-
lhs -
The left-hand side - what is being looked up. The object must follow the Query Expression API.
-
rhs -
The right-hand side - what
lhsis being compared against. It can be a plain value, or something that compiles into SQL, typically anF()object or aQuerySet.
-
lookup_name -
The name of this lookup, used to identify it on parsing query expressions. It cannot contain the string
"__".
-
process_lhs(compiler, connection, lhs=None)[source] -
Returns a tuple
(lhs_string, lhs_params), as returned bycompiler.compile(lhs). This method can be overridden to tune how thelhsis processed.compileris anSQLCompilerobject, to be used likecompiler.compile(lhs)for compilinglhs. Theconnectioncan be used for compiling vendor specific SQL. Iflhsis notNone, use it as the processedlhsinstead ofself.lhs.
-
process_rhs(compiler, connection)[source] -
Behaves the same way as
process_lhs(), for the right-hand side.
Please login to continue.