Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed a regression in gis introduced by Query.select_fields removal

  • Loading branch information...
commit 92fc263a2898b804c3b46447fd47e2898fbf8ff1 1 parent 0d8432d
@akaariai akaariai authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 django/contrib/gis/db/models/query.py
View
6 django/contrib/gis/db/models/query.py
@@ -760,8 +760,10 @@ def _geocol_select(self, geo_field, field_name):
self.query.add_select_related([field_name])
compiler = self.query.get_compiler(self.db)
compiler.pre_sql_setup()
- rel_table, rel_col = self.query.related_select_cols[self.query.related_select_fields.index(geo_field)]
- return compiler._field_column(geo_field, rel_table)
+ for (rel_table, rel_col), field in self.query.related_select_cols:
+ if field == geo_field:
+ return compiler._field_column(geo_field, rel_table)
+ raise ValueError("%r not in self.query.related_select_cols" % geo_field)
elif not geo_field in opts.local_fields:
# This geographic field is inherited from another model, so we have to
# use the db table for the _parent_ model instead.
Please sign in to comment.
Something went wrong with that request. Please try again.