Field Lookups - lte (less than, or equal to)
Example
Get all records where id is 3 or less:
mydata = Member.objects.filter(id__lte=3).values()
Run Example »
Definition and Usage
The lte
lookup is used to get records that are less than, or equal to, a specified value.
For a less than, but not or equal to, search, use the lt
lookup.
SQL Equivalent
The SQL equivalent to the example above will be:
WHERE id <= 3;
Syntax
All Field lookup keywords must be specified with the fieldname, followed by two(!) underscore characters
__
and the keyword:
fieldname__lte=value