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:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user