kopia lustrzana https://github.com/wagtail/bakerydemo
Fixes #19, add RegexValidator for Location lat_long field
rodzic
a308f948af
commit
095e61419e
|
@ -1,3 +1,4 @@
|
||||||
|
from django.core.validators import RegexValidator
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
from modelcluster.fields import ParentalKey
|
from modelcluster.fields import ParentalKey
|
||||||
|
@ -92,7 +93,14 @@ class LocationPage(Page):
|
||||||
lat_long = models.CharField(
|
lat_long = models.CharField(
|
||||||
max_length=36,
|
max_length=36,
|
||||||
help_text="Comma separated lat/long. (Ex. 64.144367, -21.939182) \
|
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
|
# Search index configuration
|
||||||
|
|
Ładowanie…
Reference in New Issue