On Sun, Mar 15, 2009 at 2:54 PM, 3xM <3...@detfalskested.dk> wrote:

>
> Gees... It messed with my link. I'll try again:
> http://blackfin.cannedtuna.org/django-testcase.tar.gz
> >
>
It works OK here. I have added __rerpr__ method to models to get a clear
output:

for p in Project.objects.all():
    print p.name, p.persons.all()
Corporate website [James, Sean, Jennifer]
Customer x website [James, Jennifer]
Customer y website [Sean, Jennifer]

james = Person.objects.get(pk=1)

jennifer = Person.objects.get(pk=3)

Project.objects.filter(persons=james).filter(persons=jennifer)
[Corporate website, Customer x website]

Project.objects.filter(persons=james).filter(persons=jeniffer).query.as_sql()

('SELECT "stuff_project"."id", "stuff_project"."name" FROM "stuff_project"
INNER JOIN "stuff_project_persons" ON ("stuff_project"."id" =
"stuff_project_persons"."project_id") INNER JOIN "stuff_project_persons" T4
ON ("stuff_project"."id" = T4."project_id") WHERE
("stuff_project_persons"."person_id" = %s  AND T4."person_id" = %s
)',

 (1, 3))

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