程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Django ORM fuzzy query

編輯:Python

Greater than >

  • __gt

Greater than or equal to >=

  • __gte

Be careful : All the above are double underlined , What is written below is also double underlined

Less than <

  • __lt

Less than or equal to <=

  • __lte 

Exactly equal to like 'aaa'

  • __exact

Exactly equal to Ignore case ilike 'aaa'

  • __iexact 

contain like '%aaa%'

  • __contains 

contain , Ignore case ilike '%aaa%', But for sqlite Come on ,contains The effect is the same as icontains.

  • __icontains 

contain

  • __in

It's empty

  • __isnull 

With … start

  • __startswith 

With … start Ignore case

  • __istartswith 

With … ending

  • __endswith 

With … ending , Ignore case

  • __iendswith 

stay … Within the scope of

  • __range 

The year of the date field

  • __year 

The month of the date field

  • __month 

Date of the date field

  • __day 

It should be noted that , If you are using mysql, When using date query , Need to be in settings.py In the document USE_TZ  It is amended as follows USE_TZ = False


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved