Skip to content

Commit fe47d86

Browse files
committed
Improved ValidationError message of GeometryField
The error message now mentions GeoJSON.
1 parent 224b4c9 commit fe47d86

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

rest_framework_gis/fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def to_internal_value(self, value):
3636
try:
3737
return GEOSGeometry(value).geojson
3838
except (ValueError, GEOSException, OGRException, TypeError):
39-
raise ValidationError(_('Invalid format: string or unicode input unrecognized as WKT EWKT, and HEXEWKB.'))
39+
raise ValidationError(_('Invalid format: string or unicode input unrecognized as GeoJSON, WKT EWKT or HEXEWKB.'))
4040

4141
def validate_empty_values(self, data):
4242
if data == '':

tests/django_restframework_gis_tests/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class TestRestFrameworkGis(TestCase):
2121
def setUp(self):
2222
self.location_list_url = reverse('api_location_list')
2323
self.geojson_location_list_url = reverse('api_geojson_location_list')
24-
self.geos_error_message = 'Invalid format: string or unicode input unrecognized as WKT EWKT, and HEXEWKB.'
24+
self.geos_error_message = 'Invalid format: string or unicode input unrecognized as GeoJSON, WKT EWKT or HEXEWKB.'
2525

2626
def _create_locations(self):
2727
self.l1 = Location.objects.create(id=1, name='l1', slug='l1', geometry='POINT (13.0078125000020002 42.4234565179379999)')

0 commit comments

Comments
 (0)