1. 程式人生 > >Django 查詢filter 常見查詢方法

Django 查詢filter 常見查詢方法

tail 地址 lte 博客 ike isnull 查詢 精確 isn

  • __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

Django 查詢filter 常見查詢方法