lektor.db.
Expression
Expressions are used to filter down Query objects. They can be passed to the filter function in particular.
The most basic expression is created by accessing the F object
which will return an expression that points to a field. Further manipulation
of it can create more expressive expressions. F.name
literally just means
that a field by that name exists and is set to a value.
The query syntax is mostly the same in Python as well as in the Jinja 2 templates, the main difference are and and or.
>>> p.children.filter((F.name == 'foo') | (F.name == 'bar')).all() [<Page model=u'page' id=u'bar'>, <Page model=u'page' id=u'foo'>]
Compares an expression to another by ensuring inequality.
True if the left side is smaller than the right side.
True if the left side is smaller or equal to the right side.
Compares an expression to another.
True if the left side is larger than the right side.
True if the left side is larger or equal to the right side.
True if both left and right side are true.
Checks if an item contains another one.
True if a string ends with another string (case insensitive).
True if a string ends with another string (case sensitive).
True if either left and right side are true.
True if a string starts with another string (case insensitive).
True if a string starts with another string (case sensitive).
Comments