Skip to content

Commit

Permalink
fixed get_prep_value
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-the-shark committed Jul 5, 2019
1 parent 44434a7 commit f85f462
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 3 additions & 0 deletions mapbox_location_field/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ def to_python(self, value):
return parse_location(value)

def get_prep_value(self, value):
if value is None:
return value

return "{},{}".format(value[0], value[1])

def formfield(self, **kwargs):
Expand Down
1 change: 1 addition & 0 deletions mapbox_location_field/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def test_to_python(self):
def test_get_prep_value(self):
instance = LocationField()
self.assertEqual("1,5", instance.get_prep_value((1, 5)))
self.assertEqual(None, instance.get_prep_value(None))

def test_form_field(self):
instance = LocationField()
Expand Down
3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

0 comments on commit f85f462

Please sign in to comment.