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'))
精彩评论