|
@@ -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
|