Loading django/contrib/gis/tests/geoapp/tests.py +2 −1 Original line number Diff line number Diff line Loading @@ -191,7 +191,8 @@ class GeoModelTest(TestCase): cities1 = City.objects.all() # Only PostGIS would support a 'select *' query because of its recognized # HEXEWKB format for geometry fields cities2 = City.objects.raw('select id, name, asText(point) from geoapp_city') as_text = 'ST_AsText' if postgis else 'asText' cities2 = City.objects.raw('select id, name, %s(point) from geoapp_city' % as_text) self.assertEqual(len(cities1), len(list(cities2))) self.assertTrue(isinstance(cities2[0].point, Point)) Loading docs/ref/contrib/gis/tutorial.txt +2 −2 Original line number Diff line number Diff line Loading @@ -674,8 +674,8 @@ __ http://spatialreference.org/ref/epsg/32140/ .. admonition:: Raw queries When using :doc:`raw queries </topics/db/sql>`, you should generally wrap your geometry fields with the ``asText()`` SQL function so as the field value will be recognized by GEOS:: your geometry fields with the ``asText()`` SQL function (or ``ST_AsText`` for PostGIS) so as the field value will be recognized by GEOS:: City.objects.raw('SELECT id, name, asText(point) from myapp_city') Loading Loading
django/contrib/gis/tests/geoapp/tests.py +2 −1 Original line number Diff line number Diff line Loading @@ -191,7 +191,8 @@ class GeoModelTest(TestCase): cities1 = City.objects.all() # Only PostGIS would support a 'select *' query because of its recognized # HEXEWKB format for geometry fields cities2 = City.objects.raw('select id, name, asText(point) from geoapp_city') as_text = 'ST_AsText' if postgis else 'asText' cities2 = City.objects.raw('select id, name, %s(point) from geoapp_city' % as_text) self.assertEqual(len(cities1), len(list(cities2))) self.assertTrue(isinstance(cities2[0].point, Point)) Loading
docs/ref/contrib/gis/tutorial.txt +2 −2 Original line number Diff line number Diff line Loading @@ -674,8 +674,8 @@ __ http://spatialreference.org/ref/epsg/32140/ .. admonition:: Raw queries When using :doc:`raw queries </topics/db/sql>`, you should generally wrap your geometry fields with the ``asText()`` SQL function so as the field value will be recognized by GEOS:: your geometry fields with the ``asText()`` SQL function (or ``ST_AsText`` for PostGIS) so as the field value will be recognized by GEOS:: City.objects.raw('SELECT id, name, asText(point) from myapp_city') Loading