首页 > 编程 > Python > 正文

基于Django filter中用contains和icontains的区别(详解)

2019-11-25 15:33:39
字体:
来源:转载
供稿:网友
qs.filter(name__contains="e")qs.filter(name__icontains="e")

对应sql

'contains': 'LIKE BINARY %s','icontains': 'LIKE %s',

其中的BINARY是 精确大小写

而'icontains'中的'i'表示忽略大小写

以上这篇基于Django filter中用contains和icontains的区别(详解)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持武林网。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表