I looked on Django's documentation and Googled every varation of the phrase but I cannot find any documentation that exactly describes the behaviour of lookuptypes.
app.objects.filter(column__lookuptype=criteria)
I have found documentation on which lookuptypes I can use but not what they do or how to use them. For example, I have no bloody clue what __gte
does, but I cannot find good documentation on what it does either.
Is there documentation that I overlooked?
Any pointers in the right direction would be greatly appreciated. Thanks!
Django-filter is a generic, reusable application to alleviate writing some of the more mundane bits of view code. Specifically, it allows users to filter down a queryset based on a model's fields, displaying the form to let them do this.
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 .
A QuerySet represents a collection of objects from your database. It can have zero, one or many filters. Filters narrow down the query results based on the given parameters. In SQL terms, a QuerySet equates to a SELECT statement, and a filter is a limiting clause such as WHERE or LIMIT .
They are called "field lookups" in Django. Field lookups have pretty comprehensive documentation: https://docs.djangoproject.com/en/dev/ref/models/querysets/#id4
These are pretty well documented:
exact
iexact
contains
icontains
in
gt
gte
lt
lte
startswith
istartswith
endswith
iendswith
range
year
month
day
week_day
isnull
search
regex
iregex
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With