If you are looking for "OR" then use the "Q object".

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

On Apr 7, 11:39 am, Daniel <unagimiy...@gmail.com> wrote:
> Hi,
>
> Thank you for your help everyone.  I know that I need to learn python
> better, and I did read those articles.  What is still a bit unclear to
> me, though, is how could I add an "OR" or "AND" separator between Q
> objects?
>
> So I have a list of qobjects like [qObj1, qObj2, qObj3].
>
> What I want is something like Sample.objects.filter((qObj1 | qObj2),
> qObj3)
>
> I know that the default is for all Q objects to be "ANDed" together.
> I think the join operation is not going to work here, nor is
> concatenation, but is there something obvious that I'm missing?
>
> THANK YOU :>
>
> On Apr 6, 7:14 am, Vinicius Mendes <vbmen...@gmail.com> wrote:
>
> > I recommend you to read more documentation about python. It's a basic python
> > feature. You can read more about it here:
>
> >http://www.saltycrane.com/blog/2008/01/how-to-use-args-and-kwargs-in-...
>
> > Try this:
>
> > Sample.objects.filter(*qObjects)
>
> > ______________________
> > Vinícius Mendes
> > Solucione Sistemashttp://solucione.info/
>
> > On Tue, Apr 6, 2010 at 2:54 AM, Aaron <byco...@gmail.com> wrote:
> > > Sample.objects.filter(*qObjects)
>
> > > On Apr 6, 1:10 am, Daniel <unagimiy...@gmail.com> wrote:
> > > > Hi, I think that this must be super easy, but I'm kind of stumped.
>
> > > > I have a list qObjects = [qObject1, qObject2, qObject3]
> > > > What I'd like is to form this query:  Sample.objects.filter(qObject1,
> > > > qObject2, qObject3)
>
> > > > How would I accomplish what I need?  Thanks!
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Django users" group.
> > > To post to this group, send email to django-us...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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