开发者

Does Django have `__not_equal`?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜