Is there a way to express != in a database query?

Suppose I have a field 'status' that can take the values 1, 2 or 3. If I 
want to select status!=2 I can use exclude(status=2). But for more 
complicated conditions this is harder to do. What if I have two status 
fields, s1, s2 and I want to select on
   s1==1 or s2!=1
?

One way would be
   filter(s1=1, (Q(s2=2) | Q(s2=3)))

Is there any way to do this without enumerating the possible values of 
s2? I would like something like
   filter(s1=1, s2__exact__not=1)
or mayby
   filter(s1=1, !Q(s2=1))
but I don't see any way to do this in the docs. Hopefully I am just 
overlooking something!

I'm using Django 0.96 if it matters...

Thanks,
Kent


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to