summaryrefslogtreecommitdiff
path: root/django/contrib/gis/db/models/sql/query.py
diff options
context:
space:
mode:
authorJustin Bronn <jbronn@gmail.com>2009-07-16 22:38:22 +0000
committerJustin Bronn <jbronn@gmail.com>2009-07-16 22:38:22 +0000
commit53b8809277c40f5011a16d6e27b221e2f48f7f97 (patch)
treeb1fa800a24c8cfc0a6aae64492320550113d2004 /django/contrib/gis/db/models/sql/query.py
parent8d48eaa064c88533be5082e3f45638fbd48491d8 (diff)
Fixed #11489 -- `GeoQuery.resolve_columns` now recognizes annotations; disabled problematic test cases on Oracle and added notes on why.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11251 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/contrib/gis/db/models/sql/query.py')
-rw-r--r--django/contrib/gis/db/models/sql/query.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/django/contrib/gis/db/models/sql/query.py b/django/contrib/gis/db/models/sql/query.py
index 5df15a88b1..094fc5815f 100644
--- a/django/contrib/gis/db/models/sql/query.py
+++ b/django/contrib/gis/db/models/sql/query.py
@@ -13,7 +13,9 @@ from django.contrib.gis.measure import Area, Distance
ALL_TERMS = sql.constants.QUERY_TERMS.copy()
ALL_TERMS.update(SpatialBackend.gis_terms)
+# Pulling out other needed constants/routines to avoid attribute lookups.
TABLE_NAME = sql.constants.TABLE_NAME
+get_proxied_model = sql.query.get_proxied_model
class GeoQuery(sql.Query):
"""
@@ -153,7 +155,9 @@ class GeoQuery(sql.Query):
opts = self.model._meta
aliases = set()
only_load = self.deferred_to_columns()
- proxied_model = opts.proxy and opts.proxy_for_model or 0
+ # Skip all proxy to the root proxied model
+ proxied_model = get_proxied_model(opts)
+
if start_alias:
seen = {None: start_alias}
for field, model in opts.get_fields_with_model():
@@ -205,6 +209,10 @@ class GeoQuery(sql.Query):
"""
values = []
aliases = self.extra_select.keys()
+ if self.aggregates:
+ # If we have an aggregate annotation, must extend the aliases
+ # so their corresponding row values are included.
+ aliases.extend([None for i in xrange(len(self.aggregates))])
# Have to set a starting row number offset that is used for
# determining the correct starting row index -- needed for