Django 查詢filter 常見查詢方法


  • __exact 精確等於      like 'aaa'
  •  __iexact 精確等於    忽略大小寫 ilike 'aaa'
  • __contains 包含 like '%aaa%'
  • __icontains 包含        忽略大小寫 ilike '%aaa%',
  • __gt 大於
  • __gte 大於等於
  • __lt 小於
  • __lte 小於等於
  • __in 存在於一個list范圍內
  • __startswith 以...開頭
  • __istartswith 以...開頭 忽略大小寫
  • __endswith 以...結尾
  • __iendswith 以...結尾,忽略大小寫
  • __range 在...范圍內
  • __year 日期字段的年份
  • __month 日期字段的月份
  • __day 日期字段的日
  • __isnull=True/False 判斷某字段是否為空

--------------------- 本文來自 cw-Austin 的CSDN 博客 ,全文地址請點擊:https://blog.csdn.net/qq_35959613/article/details/81132034?utm_source=copy 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM