Fixed a regression in gis introduced by Query.select_fields removal
This commit is contained in:
parent
0d8432da55
commit
92fc263a28
|
@ -760,8 +760,10 @@ class GeoQuerySet(QuerySet):
|
||||||
self.query.add_select_related([field_name])
|
self.query.add_select_related([field_name])
|
||||||
compiler = self.query.get_compiler(self.db)
|
compiler = self.query.get_compiler(self.db)
|
||||||
compiler.pre_sql_setup()
|
compiler.pre_sql_setup()
|
||||||
rel_table, rel_col = self.query.related_select_cols[self.query.related_select_fields.index(geo_field)]
|
for (rel_table, rel_col), field in self.query.related_select_cols:
|
||||||
|
if field == geo_field:
|
||||||
return compiler._field_column(geo_field, rel_table)
|
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:
|
elif not geo_field in opts.local_fields:
|
||||||
# This geographic field is inherited from another model, so we have to
|
# This geographic field is inherited from another model, so we have to
|
||||||
# use the db table for the _parent_ model instead.
|
# use the db table for the _parent_ model instead.
|
||||||
|
|
Loading…
Reference in New Issue