Hi,
        I have two models, A and B.  A.anchor is a foreignkey to B.  I  
currently have the following code:

        B.objects.filter(id__in=[ x.anchor for x in  
A.function_that_applies_filter_to_A(data) ])

        function_that_applies_filter_to_A is defined elsewhere, and I'm  
really not eager to change it (it's generated by about a page of  
rather-hairy code; it checks against several other related tables,  
including some minor tree-traversal in one table).  It returns a  
QuerySet.  'data' is some processed form data from a Web POST.

        Is there a way to do this entirely in a single query, instead of  
hitting the database once, applying a filter in Python, and then  
hitting it again?

Thanks,
Adam

--~--~---------~--~----~------------~-------~--~----~
 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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to