Nested query support.

This extends previous functionality that allowed passing Query objects as the
rvals to filters. You can now pass QuerySets, which requires less poking at
opaque attributes. See the documentation of the "__in" lookup type for the
details.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9701 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2009-01-05 11:47:48 +00:00
parent 062a94ef45
commit f747b61c20
4 changed files with 59 additions and 7 deletions

View file

@ -641,6 +641,15 @@ class QuerySet(object):
"""
pass
def as_sql(self):
"""
Returns the internal query's SQL and parameters (as a tuple).
This is a private (internal) method. The name is chosen to provide
uniformity with other interfaces (in particular, the Query class).
"""
obj = self.values("pk")
return obj.query.as_nested_sql()
class ValuesQuerySet(QuerySet):
def __init__(self, *args, **kwargs):