Re: Feature proposal: Q.push(...) and QuerySet.filter(relfield=Q(...))

2011-10-04 Thread Javier Guerra Giraldez
On Tue, Oct 4, 2011 at 4:35 AM, Johannes Dollinger wrote: > as you could write Q(foo=Q(...)) instead of Q(..).push('foo') I thought that would work magically, since the Q object would just pass that to the filter(); but a quick test proved me wrong. I've just refactored

Re: Feature proposal: Q.push(...) and QuerySet.filter(relfield=Q(...))

2011-10-04 Thread Javier Guerra Giraldez
On Tue, Oct 4, 2011 at 4:35 AM, Johannes Dollinger wrote: > Thanks for starting this! > Why did you chose a staticmethod instead of an instancemethod? because it's applied recursively not just to tree.Node, but to the children and all members. it would be cleaner as a

Re: Feature proposal: Q.push(...) and QuerySet.filter(relfield=Q(...))

2011-10-04 Thread Johannes Dollinger
Am 03.10.2011 um 20:01 schrieb Javier Guerra Giraldez: > On Fri, Sep 30, 2011 at 4:37 PM, Johannes Dollinger > wrote: >> The aim of this proposal is to reuse Q objects for models that are related >> through FK or M2M fields. > > i really want to have this feature! so

Re: Feature proposal: Q.push(...) and QuerySet.filter(relfield=Q(...))

2011-10-03 Thread Javier Guerra Giraldez
On Fri, Sep 30, 2011 at 4:37 PM, Johannes Dollinger wrote: > The aim of this proposal is to reuse Q objects for models that are related > through FK or M2M fields. i really want to have this feature! so i went and did a quick implementation and created ticket #16979[1]

Re: Feature proposal: Q.push(...) and QuerySet.filter(relfield=Q(...))

2011-09-30 Thread Calvin Spealman
On Fri, Sep 30, 2011 at 5:37 PM, Johannes Dollinger wrote: > The aim of this proposal is to reuse Q objects for models that are related > through FK or M2M fields. > A simplified example would be a Q object like > >    >>> is_blue = Q(blue=True) >    >>>

Feature proposal: Q.push(...) and QuerySet.filter(relfield=Q(...))

2011-09-30 Thread Johannes Dollinger
The aim of this proposal is to reuse Q objects for models that are related through FK or M2M fields. A simplified example would be a Q object like >>> is_blue = Q(blue=True) >>> Thing.objects.filter(is_blue) that should be reused to filter the owners of things: >>>