On Thu, Jun 11, 2009 at 9:15 AM, Jashugan <jashu...@gmail.com> wrote:
>
> On Jun 10, 2:48 pm, Rowan <rna...@gmail.com> 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(received_mails__thread__started_by=F('id'))).distinct()

Yes.  This produces exactly the same query as the one with exclude.

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