Fixed #23579 -- Changed GEOSGeometry.__str__ to include the SRID

Thanks Tim Graham for the review.
This commit is contained in:
Claude Paroz 2014-10-11 21:39:38 +02:00
parent 374c14b7fd
commit 2e5b2c612e
3 changed files with 19 additions and 10 deletions

View File

@ -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."

View File

@ -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:

View File

@ -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