So, I've found a workaround, and wanted to post it here. I'm relatively new to SQL, and I suspect that if I understood better how to customize my queries a little more, I could fix my problem in a better way.
Anyways, here's the problem. I have a model class, Link, with two foreign keys to another model, Node. This model acts as an intermediary ManyToMany, so I can do something like retrieve all the links that point to a given node. That returns a QuerySet on Link. I would then like to have a QuerySet on Node, the actual nodes that do the pointing, for instance. The solution I came up with is to do this. It still requires a total of two DB hits. I'm still wondering if it's possible to get that down to 1. linkset = mynode.links_from.all() where_sql = 'id IN (' for l in linkset: where_sql += '%d, ' % l.source_id where_sql += ')' nodeset = Node.objects.extra(where=[where_sql]).order_by('created_at') --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---