Fixes #19, add RegexValidator for Location lat_long field

pull/26/head
David Ray 2017-02-11 17:29:07 -05:00
rodzic a308f948af
commit 095e61419e
1 zmienionych plików z 9 dodań i 1 usunięć

Wyświetl plik

@ -1,3 +1,4 @@
from django.core.validators import RegexValidator
from django.db import models
from modelcluster.fields import ParentalKey
@ -92,7 +93,14 @@ class LocationPage(Page):
lat_long = models.CharField(
max_length=36,
help_text="Comma separated lat/long. (Ex. 64.144367, -21.939182) \
Right click Google Maps and click 'What\'s Here'"
Right click Google Maps and click 'What\'s Here'",
validators=[
RegexValidator(
regex='^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$',
message='Lat Long must be a comma separated numeric lat and long',
code='invalid_lat_long'
),
]
)
# Search index configuration