Re: Imposing a negative constraint on related objects

2009-06-11 Thread Rowan Nairn
On Thu, Jun 11, 2009 at 9:15 AM, Jashugan wrote: > > On Jun 10, 2:48 pm, Rowan wrote: > >> Here is an English description of what I want to achieve: >> "People who have received mails with tag T, excluding mails in threads >> that they started themselves" > > Have you tried using Q objects? > >

Re: Imposing a negative constraint on related objects

2009-06-11 Thread Jashugan
On Jun 10, 2:48 pm, Rowan wrote: > Here is an English description of what I want to achieve: > "People who have received mails with tag T, excluding mails in threads > that they started themselves" Have you tried using Q objects? Person.objects.filter( Q(received_mails__tags=T) & \ !Q(

Imposing a negative constraint on related objects

2009-06-10 Thread Rowan
Hi, I'm having problems fitting a certain query I want to do into the ORM framework and I find myself having to resort to raw SQL. This doesn't seem like such an uncommon type of query to do so I'm wondering if someone knows of a better way to phrase it. What I want to do is join through a tab