summaryrefslogtreecommitdiff
path: root/django/contrib/gis/db/models/aggregates.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/contrib/gis/db/models/aggregates.py')
-rw-r--r--django/contrib/gis/db/models/aggregates.py27
1 files changed, 5 insertions, 22 deletions
diff --git a/django/contrib/gis/db/models/aggregates.py b/django/contrib/gis/db/models/aggregates.py
index fc359393b3..cd26839eb5 100644
--- a/django/contrib/gis/db/models/aggregates.py
+++ b/django/contrib/gis/db/models/aggregates.py
@@ -1,34 +1,17 @@
from django.db.models import Aggregate
-from django.contrib.gis.db.backend import SpatialBackend
from django.contrib.gis.db.models.sql import GeomField
-class GeoAggregate(Aggregate):
-
- def add_to_query(self, query, alias, col, source, is_summary):
- if hasattr(source, 'geom_type'):
- # Doing additional setup on the Query object for spatial aggregates.
- aggregate = getattr(query.aggregates_module, self.name)
-
- # Adding a conversion class instance and any selection wrapping
- # SQL (e.g., needed by Oracle).
- if aggregate.conversion_class is GeomField:
- query.extra_select_fields[alias] = GeomField()
- if SpatialBackend.select:
- query.custom_select[alias] = SpatialBackend.select
-
- super(GeoAggregate, self).add_to_query(query, alias, col, source, is_summary)
-
-class Collect(GeoAggregate):
+class Collect(Aggregate):
name = 'Collect'
-class Extent(GeoAggregate):
+class Extent(Aggregate):
name = 'Extent'
-class Extent3D(GeoAggregate):
+class Extent3D(Aggregate):
name = 'Extent3D'
-class MakeLine(GeoAggregate):
+class MakeLine(Aggregate):
name = 'MakeLine'
-class Union(GeoAggregate):
+class Union(Aggregate):
name = 'Union'