Skip to content

Commit

Permalink
Merge pull request #246 from gregor2004ua/patch-1
Browse files Browse the repository at this point in the history
Gracefully handle [null, null] for GeoPointField value
  • Loading branch information
BurkovBA authored Dec 15, 2017
2 parents d4a13e3 + 33d88b6 commit 2fe6de5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rest_framework_mongoengine/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,8 @@ def to_internal_value(self, value):
self.fail('not_a_list', input_value=repr(value))
if len(value) != 2:
self.fail('not_2d', input_value=repr(value))
if value == [None, None]:
return value
try:
return [float(value[0]), float(value[1])]
except ValueError:
Expand Down

0 comments on commit 2fe6de5

Please sign in to comment.