alireza
alireza

Reputation: 45

filtering objects in django with special rules

How can you do a filter and do something like this in django

model.objects.filter(user_id = request.user.id , thing != 0)

I mean i wnat do something that it get only objects that their thing in not 0 .

Upvotes: 0

Views: 77

Answers (1)

yagus
yagus

Reputation: 1445

The exclude() method will do the job.

 model.objects.filter(user_id = request.user.id).exclude(thing = 0)

Upvotes: 2

Related Questions