summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2019-10-01 06:23:17 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2019-10-01 11:49:34 (GMT)
commita413d67417ce1025b87d9719a9e0a40a53a1eea7 (patch)
tree38caef793bbf52e1e70bf5cec348b9fdd657cecc
parentd1c8438d7a4bc3e9e825231609fea3c1e1fe71a5 (diff)
downloadcombo-a413d67417ce1025b87d9719a9e0a40a53a1eea7.zip
combo-a413d67417ce1025b87d9719a9e0a40a53a1eea7.tar.gz
combo-a413d67417ce1025b87d9719a9e0a40a53a1eea7.tar.bz2
maps: allow variables in geojson URLs (#36124)
-rw-r--r--combo/apps/maps/forms.py6
-rw-r--r--combo/apps/maps/migrations/0001_initial.py2
-rw-r--r--combo/apps/maps/models.py2
3 files changed, 8 insertions, 2 deletions
diff --git a/combo/apps/maps/forms.py b/combo/apps/maps/forms.py
index 75d2539..b9473dd 100644
--- a/combo/apps/maps/forms.py
+++ b/combo/apps/maps/forms.py
@@ -17,7 +17,9 @@
from django import forms
from django.utils.encoding import force_text
from django.utils.text import slugify
+from django.utils.translation import ugettext_lazy as _
+from combo.data.fields import TemplatableURLField
from .models import MapLayer
@@ -26,6 +28,8 @@ class IconRadioSelect(forms.RadioSelect):
class MapNewLayerForm(forms.ModelForm):
+ geojson_url = TemplatableURLField(label=_('Geojson URL'))
+
class Meta:
model = MapLayer
exclude = ('slug', 'cache_duration', 'include_user_identifier')
@@ -41,6 +45,8 @@ class MapNewLayerForm(forms.ModelForm):
class MapLayerForm(forms.ModelForm):
+ geojson_url = TemplatableURLField(label=_('Geojson URL'))
+
class Meta:
model = MapLayer
fields = '__all__'
diff --git a/combo/apps/maps/migrations/0001_initial.py b/combo/apps/maps/migrations/0001_initial.py
index 71ed0b3..e803ade 100644
--- a/combo/apps/maps/migrations/0001_initial.py
+++ b/combo/apps/maps/migrations/0001_initial.py
@@ -17,7 +17,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('label', models.CharField(max_length=128, verbose_name='Label')),
('slug', models.SlugField(verbose_name='Identifier')),
- ('geojson_url', models.URLField(max_length=1024, verbose_name='Geojson URL')),
+ ('geojson_url', models.CharField(max_length=1024, verbose_name='Geojson URL')),
('marker_colour', models.CharField(default=b'#0000FF', max_length=7, verbose_name='Marker colour')),
('icon', models.CharField(blank=True, max_length=32, null=True, verbose_name='Marker icon', choices=ICONS)),
('icon_colour', models.CharField(default=b'#000000', max_length=7, verbose_name='Icon colour')),
diff --git a/combo/apps/maps/models.py b/combo/apps/maps/models.py
index b3f9d66..e9c9600 100644
--- a/combo/apps/maps/models.py
+++ b/combo/apps/maps/models.py
@@ -96,7 +96,7 @@ class MapLayer(models.Model):
label = models.CharField(_('Label'), max_length=128)
slug = models.SlugField(_('Identifier'))
- geojson_url = models.URLField(_('Geojson URL'), max_length=1024)
+ geojson_url = models.CharField(_('Geojson URL'), max_length=1024)
marker_colour = models.CharField(_('Marker colour'), max_length=7, default='#0000FF')
icon = models.CharField(_('Marker icon'), max_length=32, blank=True, null=True,
choices=ICONS)