Django filter() lookup type documentation

為{幸葍}努か 提交于 2020-05-22 12:51:08

问题


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!


回答1:


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



回答2:


"Field lookups" documentation.



来源:https://stackoverflow.com/questions/10873249/django-filter-lookup-type-documentation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!