diff -r e349ad1b2b34 django/contrib/gis/db/models/sql/compiler.py
a
|
b
|
|
171 | 171 | """ |
172 | 172 | values = [] |
173 | 173 | aliases = self.query.extra_select.keys() |
174 | | if self.query.aggregates: |
175 | | # If we have an aggregate annotation, must extend the aliases |
176 | | # so their corresponding row values are included. |
177 | | aliases.extend([None for i in xrange(len(self.query.aggregates))]) |
178 | 174 | |
179 | 175 | # Have to set a starting row number offset that is used for |
180 | 176 | # determining the correct starting row index -- needed for |
diff -r e349ad1b2b34 django/contrib/gis/tests/relatedapp/tests.py
a
|
b
|
|
245 | 245 | self.assertEqual(1, len(vqs)) |
246 | 246 | self.assertEqual(3, vqs[0]['num_books']) |
247 | 247 | |
| 248 | def test13c_count(self): |
| 249 | "Testing `Count` aggregate with `.values()`. See #15305." |
| 250 | qs = Location.objects.filter(id=5).annotate(num_cities=Count('city')).values('id', 'point', 'num_cities') |
| 251 | self.assertEqual(1, len(qs)) |
| 252 | self.assertEqual(2, qs[0]['num_cities']) |
| 253 | self.assertTrue(isinstance(qs[0]['point'], GEOSGeometry)) |
| 254 | |
248 | 255 | # TODO: The phantom model does appear on Oracle. |
249 | 256 | @no_oracle |
250 | 257 | def test13_select_related_null_fk(self): |