I'm having trouble with a particular query under the Django ORM.

I have two models: Ticket and Target which have a many-to-many relationship.
I want to list the cross-product of the two.

For instance let say that Tickets Ref001 and Ref002 are both linked to
Targets Tgt001, Tgt002 and Tgt003, I want a query that returns:

Ref001     Tgt001
Ref001     Tg1002
Ref001     Tgt003
Ref002     Tgt001
Ref002     Tg1002
Ref002     Tgt003

I could simply iterate on either Targets or Tickets but then I would lose
both count and slicing which are very important given the huge volume of
data those models contain.

Is there any way to get the result I want without falling back to raw SQL?

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