You have to use `Q` objects [1]

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


On Sat, Feb 21, 2009 at 9:40 PM, Nate Morse <morse.n...@gmail.com> wrote:

>
> Before I go down the road of writing SQL by hand or using
> QuerySet.extra(...) [ don't know much about that yet:], I thought I
> would ask if there is a way to achieve (within the QuerySet methods)
> something like
> ...WHERE field_a = 'abc' OR field_b = '123' ...?
>
> It seems if I do:
> rs = mymodel.filter(field_a = 'abc', field_b = '123')
>
> it produces an AND conjunction (fine in most cases, but I would like
> "OR" instead).
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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