Add back TileLayer and Licence creation migration
Lost during merge with django-leaflet-storage
This commit is contained in:
parent
52fa732f8a
commit
705d0cbb73
3 changed files with 57 additions and 4 deletions
28
umap/migrations/0003_add_tilelayer.py
Normal file
28
umap/migrations/0003_add_tilelayer.py
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
# Generated by Django 1.10.3 on 2016-11-26 16:02
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
def add_tilelayer(apps, *args):
|
||||||
|
TileLayer = apps.get_model('umap', 'TileLayer')
|
||||||
|
if TileLayer.objects.count():
|
||||||
|
return
|
||||||
|
TileLayer(
|
||||||
|
name='Positron',
|
||||||
|
url_template=('https://cartodb-basemaps-{s}.global.ssl.fastly.net/'
|
||||||
|
'light_all/{z}/{x}/{y}.png'),
|
||||||
|
attribution=('© [[http://www.openstreetmap.org/copyright|'
|
||||||
|
'OpenStreetMap]] contributors, © '
|
||||||
|
'[[https://carto.com/attributions|CARTO]]')).save()
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('umap', '0002_tilelayer_tms'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(add_tilelayer),
|
||||||
|
]
|
24
umap/migrations/0004_add_licence.py
Normal file
24
umap/migrations/0004_add_licence.py
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# Generated by Django 1.10.3 on 2016-11-26 16:11
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
def add_licence(apps, *args):
|
||||||
|
Licence = apps.get_model('umap', 'Licence')
|
||||||
|
if Licence.objects.count():
|
||||||
|
return
|
||||||
|
Licence(
|
||||||
|
name='ODbL',
|
||||||
|
details='http://opendatacommons.org/licenses/odbl/').save()
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('umap', '0003_add_tilelayer'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(add_licence),
|
||||||
|
]
|
|
@ -4,8 +4,8 @@ import tempfile
|
||||||
import pytest
|
import pytest
|
||||||
from django.core.signing import get_cookie_signer
|
from django.core.signing import get_cookie_signer
|
||||||
|
|
||||||
from .base import (DataLayerFactory, LicenceFactory, MapFactory,
|
from .base import DataLayerFactory, MapFactory, UserFactory
|
||||||
TileLayerFactory, UserFactory)
|
from umap.models import Licence, TileLayer
|
||||||
|
|
||||||
TMP_ROOT = tempfile.mkdtemp()
|
TMP_ROOT = tempfile.mkdtemp()
|
||||||
|
|
||||||
|
@ -26,7 +26,8 @@ def user():
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def licence():
|
def licence():
|
||||||
return LicenceFactory()
|
# Should be created by the migrations.
|
||||||
|
return Licence.objects.last()
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
@ -61,4 +62,4 @@ def datalayer(map):
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def tilelayer():
|
def tilelayer():
|
||||||
return TileLayerFactory()
|
return TileLayer.objects.last()
|
||||||
|
|
Loading…
Reference in a new issue