Skip to content

Commit

Permalink
Improved ValidationError message of GeometryField
Browse files Browse the repository at this point in the history
The error message now mentions GeoJSON.
  • Loading branch information
nemesifier committed Jul 17, 2015
1 parent 224b4c9 commit fe47d86
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rest_framework_gis/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def to_internal_value(self, value):
try:
return GEOSGeometry(value).geojson
except (ValueError, GEOSException, OGRException, TypeError):
raise ValidationError(_('Invalid format: string or unicode input unrecognized as WKT EWKT, and HEXEWKB.'))
raise ValidationError(_('Invalid format: string or unicode input unrecognized as GeoJSON, WKT EWKT or HEXEWKB.'))

def validate_empty_values(self, data):
if data == '':
Expand Down
2 changes: 1 addition & 1 deletion tests/django_restframework_gis_tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class TestRestFrameworkGis(TestCase):
def setUp(self):
self.location_list_url = reverse('api_location_list')
self.geojson_location_list_url = reverse('api_geojson_location_list')
self.geos_error_message = 'Invalid format: string or unicode input unrecognized as WKT EWKT, and HEXEWKB.'
self.geos_error_message = 'Invalid format: string or unicode input unrecognized as GeoJSON, WKT EWKT or HEXEWKB.'

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

0 comments on commit fe47d86

Please sign in to comment.