I have a complicated query set to do, does anyone have any suggestions
on the least insane way to do it?

I need to merge two querysets and only get out ones with a common
field:

ModelOne.objects.filter(x=whatever)
ModelTwo.objects.filter(y=foo)

both of these objects have a property which is a django user (eg:
ModelOne.owner and ModelTwo.winner)

I want to get a queryset where only both querysets share the same user
property
eg: (ModelOne filter + ModelTwo filter) where ModelOne.owner eq
ModelTwo.winner)

I'm pretty new to django and ORM layers in general, so I have no idea
how to do this without getting all the results into a regular python
list and filtering it using normal python methods or writing custom
SQL. For bonus points this query will be run 10 times a page, so it
needs to be at least vaguely quick :-/

Even if you don't have a full answer, clues on what to go look up or
try and do would be appreciated!

Edward

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