On Tue, May 17, 2011 at 2:57 PM, Michal Petrucha <michal.petru...@ksp.sk>wrote:

> On Mon, May 16, 2011 at 11:54:14PM +0200, Marc Aymerich wrote:
> > > > when I call Model.objects.active_during(Q(Q(ini=some_date,
> end=some_date)
> > > |
> > > > Q(ini=other_date, fin=other_date))) I get This error:
> > > >
> > > >
> > > > active_during() takes exactly 3 arguments (2 given)
> >
> > Hi Michal,
> > Yep, this is actually what I want to do, pass a Q() object to the
> > active_during() method. My question is, how the active_during method
> should
> > be in order to work with a Q() object passed as a parameter?
> >
> > sorry if I wasn't clear in my firts mail.
>
> Eh, now I probably see what you're trying to do. Well, I don't say it
> is impossible, however, here you're trying to misuse Q objects in a
> way they are not supposed to work.
>
> A Q object is intended to represent a primitive filter on a model
> field or a composition of such filters. If I understand right, you're
> trying to make a single Q object represent a composition of primitive
> filters.
>
> I see two options here:
> 1) modify the active_during method to accept a list of tuples where
>   each tuple would be (ini, end) and then build a disjunction of such
>   individual filters
>


Hi Michal,
Thanks for your answer,
Just right now I have finished the implementation of the the manager with a
list of tuples  :)

-- 
Marc

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