diff --git a/django/contrib/gis/db/backends/spatialite/operations.py b/django/contrib/gis/db/backends/spatialite/operations.py index f4aef508b5..485e7ed419 100644 --- a/django/contrib/gis/db/backends/spatialite/operations.py +++ b/django/contrib/gis/db/backends/spatialite/operations.py @@ -39,6 +39,7 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations): intersection = 'Intersection' kml = 'AsKML' length = 'GLength' # OpenGis defines Length, but this conflicts with an SQLite reserved keyword + makeline = 'MakeLine' num_geom = 'NumGeometries' num_points = 'NumPoints' point_on_surface = 'PointOnSurface' @@ -80,6 +81,8 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations): 'distance_lte': SpatialOperator(func='Distance', op='<='), } + disallowed_aggregates = (aggregates.Extent3D,) + @cached_property def function_names(self): return { @@ -114,11 +117,6 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations): raise ImproperlyConfigured('GeoDjango only supports SpatiaLite versions 3.0.0 and above.') return version - @cached_property - def disallowed_aggregates(self): - disallowed = (aggregates.Extent3D, aggregates.MakeLine) - return disallowed - def convert_extent(self, box, srid): """ Convert the polygon data received from Spatialite to min/max values. diff --git a/docs/ref/contrib/gis/db-api.txt b/docs/ref/contrib/gis/db-api.txt index f3c61574ef..45bc18992b 100644 --- a/docs/ref/contrib/gis/db-api.txt +++ b/docs/ref/contrib/gis/db-api.txt @@ -348,7 +348,7 @@ Aggregate PostGIS Oracle SpatiaLite :class:`Collect` X X :class:`Extent` X X X :class:`Extent3D` X -:class:`MakeLine` X +:class:`MakeLine` X X :class:`Union` X X X ======================= ======= ====== ========== diff --git a/docs/ref/contrib/gis/geoquerysets.txt b/docs/ref/contrib/gis/geoquerysets.txt index 28d50e4398..c3aae137c1 100644 --- a/docs/ref/contrib/gis/geoquerysets.txt +++ b/docs/ref/contrib/gis/geoquerysets.txt @@ -1297,11 +1297,15 @@ Example:: .. class:: MakeLine(geo_field) -*Availability*: PostGIS +*Availability*: PostGIS, SpatiaLite Returns a ``LineString`` constructed from the point field geometries in the ``QuerySet``. Currently, ordering the queryset has no effect. +.. versionchanged:: 1.10 + + SpatiaLite support was added. + Example:: >>> print(City.objects.filter(name__in=('Houston', 'Dallas') diff --git a/docs/releases/1.10.txt b/docs/releases/1.10.txt index 33039eb73f..d1b6403f9f 100644 --- a/docs/releases/1.10.txt +++ b/docs/releases/1.10.txt @@ -79,6 +79,9 @@ Minor features :attr:`~django.contrib.gis.gdal.GDALBand.mean` and :attr:`~django.contrib.gis.gdal.GDALBand.std` attributes. +* Added support for the :class:`~django.contrib.gis.db.models.MakeLine` + aggregate on SpatiaLite. + :mod:`django.contrib.messages` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/gis_tests/geoapp/tests.py b/tests/gis_tests/geoapp/tests.py index 9c8b3f7a8d..a4a4c5e189 100644 --- a/tests/gis_tests/geoapp/tests.py +++ b/tests/gis_tests/geoapp/tests.py @@ -652,8 +652,6 @@ class GeoQuerySetTest(TestCase): Testing the `MakeLine` aggregate. """ if not connection.features.supports_make_line_aggr: - # Only PostGIS has support for the MakeLine aggregate. For other - # backends, test that NotImplementedError is raised self.assertRaises( NotImplementedError, City.objects.all().aggregate, MakeLine('point')