问题描述
我查看了 Django 的文档,并在 Google 上搜索了该短语的每个变体,但找不到任何准确描述查找类型行为的文档.
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)
我找到了关于我可以使用哪些查找类型的文档,但没有找到关于它们做什么或如何使用它们的文档.例如,我对 __gte
做什么一无所知,但我也找不到关于它做什么的好文档.
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.
是否有我忽略的文档?
任何指向正确方向的指针将不胜感激.谢谢!
Any pointers in the right direction would be greatly appreciated. Thanks!
推荐答案
它们在 Django 中被称为字段查找".字段查找有非常全面的文档:https://docs.djangoproject.com/en/dev/ref/models/querysets/#id4
They are called "field lookups" in Django. Field lookups have pretty comprehensive documentation: https://docs.djangoproject.com/en/dev/ref/models/querysets/#id4
这些都有很好的记录:
精确
iexact
contains
icontains
in
gt
gte
lt
lte
startswith
istartswith
endswith
iendswith
range
年
月
day
week_day
isnull
search
regex
iregex
这篇关于Django filter() 查找类型文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!