From 2e5b2c612ec3b410d2a35133d073341e6958eeba Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sat, 11 Oct 2014 21:39:38 +0200 Subject: [PATCH] Fixed #23579 -- Changed GEOSGeometry.__str__ to include the SRID Thanks Tim Graham for the review. --- django/contrib/gis/geos/geometry.py | 4 ++-- django/contrib/gis/tests/geoapp/tests.py | 2 +- docs/releases/1.8.txt | 23 ++++++++++++++++------- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/django/contrib/gis/geos/geometry.py b/django/contrib/gis/geos/geometry.py index 9299d3e397..00094c93fe 100644 --- a/django/contrib/gis/geos/geometry.py +++ b/django/contrib/gis/geos/geometry.py @@ -134,8 +134,8 @@ class GEOSGeometry(GEOSBase, ListMixin): return self.clone() def __str__(self): - "WKT is used for the string representation." - return self.wkt + "EWKT is used for the string representation." + return self.ewkt def __repr__(self): "Short-hand representation because WKT may be very large." diff --git a/django/contrib/gis/tests/geoapp/tests.py b/django/contrib/gis/tests/geoapp/tests.py index d5a4cd541e..b9e7a58b70 100644 --- a/django/contrib/gis/tests/geoapp/tests.py +++ b/django/contrib/gis/tests/geoapp/tests.py @@ -214,7 +214,7 @@ class GeoModelTest(TestCase): call_command('dumpdata', 'geoapp.City', stdout=out) result = out.getvalue() houston = City.objects.get(name='Houston') - self.assertIn('"point": "%s"' % houston.point.wkt, result) + self.assertIn('"point": "%s"' % houston.point.ewkt, result) # Reload now dumped data with NamedTemporaryFile(mode='w', suffix='.json') as tempfile: diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt index 94d09eed4f..63513780ad 100644 --- a/docs/releases/1.8.txt +++ b/docs/releases/1.8.txt @@ -558,6 +558,22 @@ run this query:: last_login=models.F('date_joined') ).update(last_login=None) +:mod:`django.contrib.gis` +~~~~~~~~~~~~~~~~~~~~~~~~~ + +* Support for GEOS 3.1 and GDAL 1.6 has been dropped. + +* Support for SpatiaLite < 2.4 has been dropped. + +* GIS-specific lookups have been refactored to use the + :class:`django.db.models.Lookup` API. + +* The default ``str`` representation of + :class:`~django.contrib.gis.geos.GEOSGeometry` objects has been changed from + WKT to EWKT format (including the SRID). As this representation is used in + the serialization framework, that means that ``dumpdata`` output will now + contain the SRID value of geometry objects. + Miscellaneous ~~~~~~~~~~~~~ @@ -573,13 +589,9 @@ Miscellaneous * ``URLField.to_python`` no longer adds a trailing slash to pathless URLs. -* ``django.contrib.gis`` dropped support for GEOS 3.1 and GDAL 1.6. - * The :tfilter:`length` template filter now returns ``0`` for an undefined variable, rather than an empty string. -* Support for SpatiaLite < 2.4 has been dropped. - * ``ForeignKey.default_error_message['invalid']`` has been changed from ``'%(model)s instance with pk %(pk)r does not exist.'`` to ``'%(model)s instance with %(field)s %(value)r does not exist.'`` If you are @@ -616,9 +628,6 @@ Miscellaneous :func:`~django.core.urlresolvers.reverse_lazy` now return Unicode strings instead of byte strings. -* GIS-specific lookups have been refactored to use the - :class:`django.db.models.Lookup` API. - * The ``CacheClass`` shim has been removed from all cache backends. These aliases were provided for backwards compatibility with Django 1.3. If you are still using them, please update your project to use the real