Probably want to look into using Q

http://docs.djangoproject.com/en/dev/topics/db/queries/#complex-lookups-with-q-objects

On Aug 31, 7:18 pm, Gyanit <gya...@gmail.com> wrote:
> Hi All,
>
> I don't seem to find good source to help me write a complex where condition
> in the django.
>
> The where condition is generic boolean clause built on top of literals. The
> literal are just == or != check on a single field.
> for example ((field1 == 2 and field2 != 5) or field3 == 6).
> another example ((field1 > 1 or field1 < -3) and (field2 != "comment")) or
> field3 == "django"
>
> I think it should be writable in the django queryset but I can't seem to
> formulate it in generic format.
>
> Any pointers or guidance will be great.
>
> thanks
>
> --
> View this message in 
> context:http://www.nabble.com/SQL-query-with-complex-WHERE-clause-tp25232455p...
> Sent from the django-users mailing list archive at Nabble.com.
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to