i7wzaw
Last Updated: February 25, 2016
·
1.635K
· purak
Fe0a1519fcf6d2efd7f1a0bbc20660d2

Not equal statement for Django's ORM

I need a SQL statement like the following:.

SELECT * FROM model WHERE id != 56

The equal statement of that in Django ORM, simply:

FooModel.objects.get(~Q(id = 56))

Like in C++, the ~ will negate the statement.

For detail information about Q objects, here

Say Thanks
Respond