1
0
mirror of https://github.com/django/django.git synced 2025-10-26 15:16:09 +00:00

Refs #26112 -- Fixed aggregate GIS test on Oracle.

Made sure the test doesn't try to aggregate over MultiPolygonField and made
AreaField turn decimals into floats on the way from the DB.

Thanks Daniel Wiesmann, Jani Tiainen, and Tim Graham for review and discussion.
This commit is contained in:
Shai Berger
2016-01-26 00:50:46 +02:00
committed by Tim Graham
parent 75143fa13f
commit bb51dc902d
3 changed files with 17 additions and 2 deletions

View File

@@ -240,7 +240,9 @@ class GISFunctionsTests(TestCase):
CountryWebMercator.objects.create(name=c.name, mpoly=c.mpoly)
# Test in projected coordinate system
qs = CountryWebMercator.objects.annotate(area_sum=Sum(functions.Area('mpoly')))
for c in qs:
# Some backends (e.g. Oracle) cannot group by multipolygon values, so
# defer such fields in the aggregation query.
for c in qs.defer('mpoly'):
result = c.area_sum
# If the result is a measure object, get value.
if isinstance(result, Area):