diff -r 49abe8cefc7b django/contrib/gis/db/models/sql/compiler.py
a
|
b
|
|
56 | 56 | col_aliases.add(col[1]) |
57 | 57 | else: |
58 | 58 | result.append(col.as_sql(qn, self.connection)) |
59 | | |
| 59 | |
60 | 60 | if hasattr(col, 'alias'): |
61 | 61 | aliases.add(col.alias) |
62 | 62 | col_aliases.add(col.alias) |
… |
… |
|
169 | 169 | from extra selection SQL get resolved appropriately into Python |
170 | 170 | objects. |
171 | 171 | """ |
| 172 | if not hasattr(self.query, 'extra_select_fields'): |
| 173 | return row |
172 | 174 | values = [] |
173 | 175 | aliases = self.query.extra_select.keys() |
174 | 176 | if self.query.aggregates: |
… |
… |
|
190 | 192 | self.query.extra_select_fields.get(a, None), |
191 | 193 | self.connection) |
192 | 194 | for v, a in izip(row[rn_offset:index_start], aliases)] |
| 195 | |
193 | 196 | if self.connection.ops.oracle or getattr(self.query, 'geo_values', False): |
194 | 197 | # We resolve the rest of the columns if we're on Oracle or if |
195 | 198 | # the `geo_values` attribute is defined. |
… |
… |
|
202 | 205 | #### Routines unique to GeoQuery #### |
203 | 206 | def get_extra_select_format(self, alias): |
204 | 207 | sel_fmt = '%s' |
205 | | if alias in self.query.custom_select: |
| 208 | if alias in getattr(self.query, 'custom_select', {}): |
206 | 209 | sel_fmt = sel_fmt % self.query.custom_select[alias] |
207 | 210 | return sel_fmt |
208 | 211 | |