开发者

Does Django have `__not_equal`?

开发者 https://www.devze.com 2022-12-19 06:22 出处:网络
Does Django have a field lookup like __not_equal? (Field lookups are __exact, __contains,开发者_如何学运维 etc.)Use one of __exact, __contains etc. with exclude() instead of filter().You can also use

Does Django have a field lookup like __not_equal? (Field lookups are __exact, __contains,开发者_如何学运维 etc.)


Use one of __exact, __contains etc. with exclude() instead of filter().


You can also use the Q object and negate it.

E.g.

Poll.objects.filter(~Q(question='Who'))
0

精彩评论

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