def compile_node(self, field):
"""Compile node into a cached function that performs the match.
Returns:
Callable: taking the object to match.
"""
# can embed other Q objects
if isinstance(field, type(self)):
return field
# convert Django Q objects in-place.
elif isinstance(field, _Q_):
field.__class__ = type(self)
return field
# or it's a key, value pair.
lhs, rhs = field
lhs, opcode = self.prepare_statement(lhs, rhs)
# this creates the new matching function to be added to the stack.
return self.compile_op(lhs, rhs, opcode)
评论列表
文章目录