开发者

Django not like statement

开发者 https://www.devze.com 2023-01-25 02:38 出处:网络
how to use not like in django queries开发者_JAVA技巧 Model.objects.filter(keywords not like \"null\" or \"undefined\")

how to use not like in django queries

开发者_JAVA技巧
    Model.objects.filter(keywords not like "null" or "undefined")

       select * from model where keywords not like "%undefined%"  or keywords not like "%null%";


use the exclude function and Q objects

Model.objects.exclude(Q(keyword__contains='undefined') | Q(keyword__contains='null'))
0

精彩评论

暂无评论...
验证码 换一张
取 消