From 26924c9aa50f7774700afea4da843f1d24d155b2 Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Thu, 21 Jan 2021 13:47:47 +0100 Subject: [PATCH 01/28] Change ci, add routing --- .github/workflows/python-package.yml | 33 ++++++++++++++++---------- test_terra_geocrud/settings/routing.py | 5 ++++ 2 files changed, 26 insertions(+), 12 deletions(-) create mode 100644 test_terra_geocrud/settings/routing.py diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 9f8300a9..603377b6 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -13,9 +13,18 @@ jobs: build: runs-on: ubuntu-latest + strategy: + matrix: + python-version: [ 3.6, 3.8 ] + django-version: [ 2.2, 3.1, dev ] + routing: [ true, false ] + postgres: [ 'postgis/postgis:10-2.5', 'pgrouting/pgrouting:10-2.5-2.6.3' ] + include: + - django-version: dev + experimental: true services: postgres: - image: postgis/postgis:10-2.5 + image: ${{ matrix.postgres }} env: POSTGRES_DB: travis_ci_test POSTGRES_PASSWORD: travis_ci_test @@ -25,13 +34,7 @@ jobs: # Set health checks to wait until postgres has started options: >- --health-cmd pg_isready - strategy: - matrix: - python-version: [3.6, 3.8] - django-version: [2.2, 3.1, dev] - include: - - django-version: dev - experimental: true + steps: - uses: actions/checkout@v2 @@ -44,7 +47,11 @@ jobs: run: | sudo apt-get -y install libproj-dev binutils gdal-bin libgdal-dev python -m pip install --upgrade pip setuptools wheel - pip install .[dev] -U + if [[ ${{ matrix.routing }} ]]; then + pip install .[dev,routing] -U + else + pip install .[dev] -U + fi if [[ ${{ matrix.django-version }} == dev ]]; then pip install -e git+https://github.com/django/django@master#egg=django; else @@ -53,9 +60,11 @@ jobs: - name: Test with coverage run: | - coverage run ./manage.py test - coverage run -a ./manage.py test --settings=test_terra_geocrud.settings.async terra_geocrud.tests.test_serializers.CrudViewSerializerTestCase.test_exports_with_async_mode - + coverage run ./manage.py test --exclude-tag=routing + coverage run -a ./manage.py test --exclude-tag=routing --settings=test_terra_geocrud.settings.async terra_geocrud.tests.test_serializers.CrudViewSerializerTestCase.test_exports_with_async_mode + if [[ ${{ matrix.routing }} ]]; then + coverage run ./manage.py test --tag=routing --settings=test_terra_geocrud.settings.routing + fi - name: Coverage upload run: | pip install codecov diff --git a/test_terra_geocrud/settings/routing.py b/test_terra_geocrud/settings/routing.py new file mode 100644 index 00000000..e1b9141a --- /dev/null +++ b/test_terra_geocrud/settings/routing.py @@ -0,0 +1,5 @@ +from . import * # NOQA + +INSTALLED_APPS += ( + 'geostore_routing', +) From 73739a0bdb0b8b63e4c33edb496d7f881593171f Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Thu, 21 Jan 2021 14:10:05 +0100 Subject: [PATCH 02/28] Fix ci --- .github/workflows/python-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 603377b6..b8538a39 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -47,7 +47,7 @@ jobs: run: | sudo apt-get -y install libproj-dev binutils gdal-bin libgdal-dev python -m pip install --upgrade pip setuptools wheel - if [[ ${{ matrix.routing }} ]]; then + if [[ ${{ matrix.routing }} == true ]]; then pip install .[dev,routing] -U else pip install .[dev] -U @@ -62,7 +62,7 @@ jobs: run: | coverage run ./manage.py test --exclude-tag=routing coverage run -a ./manage.py test --exclude-tag=routing --settings=test_terra_geocrud.settings.async terra_geocrud.tests.test_serializers.CrudViewSerializerTestCase.test_exports_with_async_mode - if [[ ${{ matrix.routing }} ]]; then + if [[ ${{ matrix.routing }} == true ]]; then coverage run ./manage.py test --tag=routing --settings=test_terra_geocrud.settings.routing fi - name: Coverage upload From 03cfa2a91aff08541ec237506d2009cb4fa17c28 Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Thu, 21 Jan 2021 14:15:18 +0100 Subject: [PATCH 03/28] Add flake8 --- .flake8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.flake8 b/.flake8 index 995fafa7..53ac9fed 100644 --- a/.flake8 +++ b/.flake8 @@ -1,3 +1,3 @@ [flake8] ignore = E501,W503 -exclude = **settings/dev.py +exclude = **settings/dev.py, **settings/routing.py From 9cf4b6708c6e653d147c48a1b66bff80b22dbdc9 Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Thu, 21 Jan 2021 15:08:55 +0100 Subject: [PATCH 04/28] Fix ci continue on error --- .github/workflows/python-package.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index b8538a39..d4a47381 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -13,15 +13,18 @@ jobs: build: runs-on: ubuntu-latest + continue-on-error: ${{ matrix.experimental }} strategy: matrix: python-version: [ 3.6, 3.8 ] - django-version: [ 2.2, 3.1, dev ] - routing: [ true, false ] + django-version: [ 2.2, 3.1, 3.2, dev ] postgres: [ 'postgis/postgis:10-2.5', 'pgrouting/pgrouting:10-2.5-2.6.3' ] + experimental: [false] include: - django-version: dev experimental: true + - django-version: 3.2 + experimental: true services: postgres: image: ${{ matrix.postgres }} @@ -47,7 +50,7 @@ jobs: run: | sudo apt-get -y install libproj-dev binutils gdal-bin libgdal-dev python -m pip install --upgrade pip setuptools wheel - if [[ ${{ matrix.routing }} == true ]]; then + if [[ ${{ matrix.postgres }} == 'pgrouting/pgrouting:10-2.5-2.6.3' ]]; then pip install .[dev,routing] -U else pip install .[dev] -U @@ -60,9 +63,10 @@ jobs: - name: Test with coverage run: | - coverage run ./manage.py test --exclude-tag=routing - coverage run -a ./manage.py test --exclude-tag=routing --settings=test_terra_geocrud.settings.async terra_geocrud.tests.test_serializers.CrudViewSerializerTestCase.test_exports_with_async_mode - if [[ ${{ matrix.routing }} == true ]]; then + if [[ ${{ matrix.postgres }} == 'postgis/postgis:10-2.5' ]]; then + coverage run ./manage.py test + coverage run -a ./manage.py test --settings=test_terra_geocrud.settings.async terra_geocrud.tests.test_serializers.CrudViewSerializerTestCase.test_exports_with_async_mode + else coverage run ./manage.py test --tag=routing --settings=test_terra_geocrud.settings.routing fi - name: Coverage upload From c0a79bb370321af255940b244c5a9e5b202766a1 Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Thu, 21 Jan 2021 15:18:32 +0100 Subject: [PATCH 05/28] Remove version include special experimental --- .github/workflows/python-package.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index d4a47381..7d054d50 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -17,14 +17,26 @@ jobs: strategy: matrix: python-version: [ 3.6, 3.8 ] - django-version: [ 2.2, 3.1, 3.2, dev ] + django-version: [ 2.2, 3.1 ] postgres: [ 'postgis/postgis:10-2.5', 'pgrouting/pgrouting:10-2.5-2.6.3' ] experimental: [false] include: - django-version: dev experimental: true + python-version: 3.8 + postgres: 'postgis/postgis:10-2.5' + - django-version: dev + experimental: true + python-version: 3.8 + postgres: 'pgrouting/pgrouting:10-2.5-2.6.3' + - django-version: 3.2 + experimental: true + python-version: 3.8 + postgres: 'postgis/postgis:10-2.5' - django-version: 3.2 experimental: true + python-version: 3.8 + postgres: 'pgrouting/pgrouting:10-2.5-2.6.3' services: postgres: image: ${{ matrix.postgres }} From 5d3911dc00fb42b83a24517edac2bd2786324980 Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Thu, 21 Jan 2021 15:21:14 +0100 Subject: [PATCH 06/28] Run ci on 18.04 --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 7d054d50..db6e6b62 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -12,7 +12,7 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-18.04 continue-on-error: ${{ matrix.experimental }} strategy: matrix: From ceb21516636cc13a838770af5239fc78c495c4ad Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Thu, 21 Jan 2021 15:37:15 +0100 Subject: [PATCH 07/28] Fix tests no routing --- .github/workflows/python-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index db6e6b62..a826c1d9 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -76,8 +76,8 @@ jobs: - name: Test with coverage run: | if [[ ${{ matrix.postgres }} == 'postgis/postgis:10-2.5' ]]; then - coverage run ./manage.py test - coverage run -a ./manage.py test --settings=test_terra_geocrud.settings.async terra_geocrud.tests.test_serializers.CrudViewSerializerTestCase.test_exports_with_async_mode + coverage run ./manage.py test --exlude-tag=routing + coverage run -a ./manage.py test --exlude-tag=routing --settings=test_terra_geocrud.settings.async terra_geocrud.tests.test_serializers.CrudViewSerializerTestCase.test_exports_with_async_mode else coverage run ./manage.py test --tag=routing --settings=test_terra_geocrud.settings.routing fi From 2739bd646e09233d51ba3ea9b25f87c26e9be387 Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Thu, 21 Jan 2021 15:56:06 +0100 Subject: [PATCH 08/28] Fix ci --- .github/workflows/python-package.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index a826c1d9..97f2200e 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -18,7 +18,7 @@ jobs: matrix: python-version: [ 3.6, 3.8 ] django-version: [ 2.2, 3.1 ] - postgres: [ 'postgis/postgis:10-2.5', 'pgrouting/pgrouting:10-2.5-2.6.3' ] + postgres: [ postgis/postgis:10-2.5, pgrouting/pgrouting:10-2.5-2.6.3 ] experimental: [false] include: - django-version: dev @@ -62,7 +62,7 @@ jobs: run: | sudo apt-get -y install libproj-dev binutils gdal-bin libgdal-dev python -m pip install --upgrade pip setuptools wheel - if [[ ${{ matrix.postgres }} == 'pgrouting/pgrouting:10-2.5-2.6.3' ]]; then + if [[ ${{ matrix.postgres }} == pgrouting/pgrouting:10-2.5-2.6.3 ]]; then pip install .[dev,routing] -U else pip install .[dev] -U @@ -75,7 +75,7 @@ jobs: - name: Test with coverage run: | - if [[ ${{ matrix.postgres }} == 'postgis/postgis:10-2.5' ]]; then + if [[ ${{ matrix.postgres }} == postgis/postgis:10-2.5 ]]; then coverage run ./manage.py test --exlude-tag=routing coverage run -a ./manage.py test --exlude-tag=routing --settings=test_terra_geocrud.settings.async terra_geocrud.tests.test_serializers.CrudViewSerializerTestCase.test_exports_with_async_mode else From 3ceb62fd6a0330bcb751b3723bef1c53d69467b9 Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Thu, 21 Jan 2021 16:02:32 +0100 Subject: [PATCH 09/28] Fix routing --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 3fb1588a..cd599f51 100644 --- a/setup.py +++ b/setup.py @@ -72,6 +72,7 @@ ], tests_require=tests_require, extras_require={ + 'routing': ['django-geostore-routing'], 'dev': tests_require + [ 'django-debug-toolbar', ] From cf290b7c8a39d678ee498bc117e3c599b0f29665 Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Thu, 21 Jan 2021 16:07:16 +0100 Subject: [PATCH 10/28] Back to string ci --- .github/workflows/python-package.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 97f2200e..16dfc440 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -18,7 +18,7 @@ jobs: matrix: python-version: [ 3.6, 3.8 ] django-version: [ 2.2, 3.1 ] - postgres: [ postgis/postgis:10-2.5, pgrouting/pgrouting:10-2.5-2.6.3 ] + postgres: [ 'postgis/postgis:10-2.5', 'pgrouting/pgrouting:10-2.5-2.6.3' ] experimental: [false] include: - django-version: dev @@ -62,7 +62,7 @@ jobs: run: | sudo apt-get -y install libproj-dev binutils gdal-bin libgdal-dev python -m pip install --upgrade pip setuptools wheel - if [[ ${{ matrix.postgres }} == pgrouting/pgrouting:10-2.5-2.6.3 ]]; then + if [[ '${{ matrix.postgres }}' == 'pgrouting/pgrouting:10-2.5-2.6.3' ]]; then pip install .[dev,routing] -U else pip install .[dev] -U @@ -75,7 +75,7 @@ jobs: - name: Test with coverage run: | - if [[ ${{ matrix.postgres }} == postgis/postgis:10-2.5 ]]; then + if [[ '${{ matrix.postgres }}' == 'postgis/postgis:10-2.5' ]]; then coverage run ./manage.py test --exlude-tag=routing coverage run -a ./manage.py test --exlude-tag=routing --settings=test_terra_geocrud.settings.async terra_geocrud.tests.test_serializers.CrudViewSerializerTestCase.test_exports_with_async_mode else From fed74354df8e09840b3e29851609b38e99614bee Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Thu, 21 Jan 2021 16:15:50 +0100 Subject: [PATCH 11/28] Fix typo ci --- .github/workflows/python-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 16dfc440..a88e677d 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -76,8 +76,8 @@ jobs: - name: Test with coverage run: | if [[ '${{ matrix.postgres }}' == 'postgis/postgis:10-2.5' ]]; then - coverage run ./manage.py test --exlude-tag=routing - coverage run -a ./manage.py test --exlude-tag=routing --settings=test_terra_geocrud.settings.async terra_geocrud.tests.test_serializers.CrudViewSerializerTestCase.test_exports_with_async_mode + coverage run ./manage.py test --exclude-tag=routing + coverage run -a ./manage.py test --exclude-tag=routing --settings=test_terra_geocrud.settings.async terra_geocrud.tests.test_serializers.CrudViewSerializerTestCase.test_exports_with_async_mode else coverage run ./manage.py test --tag=routing --settings=test_terra_geocrud.settings.routing fi From c8cf90a6eb26423ee29c53333636e22aa0d8d5b9 Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Thu, 21 Jan 2021 16:29:48 +0100 Subject: [PATCH 12/28] Add routingsettings --- terra_geocrud/models.py | 15 +++++++++++++++ terra_geocrud/serializers.py | 21 ++++++++++++++++++++- terra_geocrud/tests/factories.py | 9 ++++++++- terra_geocrud/tests/test_views.py | 18 ++++++++++++++++-- 4 files changed, 59 insertions(+), 4 deletions(-) diff --git a/terra_geocrud/models.py b/terra_geocrud/models.py index b73a73d8..ef6be769 100644 --- a/terra_geocrud/models.py +++ b/terra_geocrud/models.py @@ -346,3 +346,18 @@ class Meta: unique_together = ( ('value', 'property'), ) + + +class RoutingSettings(models.Model): + label = models.CharField(max_length=250, help_text=_("Label that will be shown on the list")) + provider = models.CharField(max_length=250, help_text=_("Provider's name"), choices=(("Mapbox", _("Mapbox")), + ("Geostore", _("Geostore")))) + layer = models.OneToOneField('geostore.Layer', related_name='routing_settings', on_delete=models.CASCADE, null=True) + mapbox_transit = models.CharField(max_length=250, help_text=_("Mabox transit"), choices=(("Driving", _("Driving")), + ("Walking", _("Walking")), + ("Walking", _("Cycling")) + ), null=True) + crud_view = models.ForeignKey(CrudView, related_name='routing_settings', on_delete=models.CASCADE) + + def __str__(self): + return self.label diff --git a/terra_geocrud/serializers.py b/terra_geocrud/serializers.py index 46ada0c5..ebbfecb4 100644 --- a/terra_geocrud/serializers.py +++ b/terra_geocrud/serializers.py @@ -65,6 +65,7 @@ class CrudViewSerializer(serializers.ModelSerializer): feature_list_properties = serializers.SerializerMethodField( help_text=_("Available properties for feature datatable. Ordered, {name: {title, type}}") ) + routing_settings = serializers.SerializerMethodField() def get_object_name(self, obj): return obj.object_name if obj.object_name else obj.name @@ -123,6 +124,23 @@ def get_feature_list_properties(self, obj): def get_feature_endpoint(self, obj): return reverse('feature-list', args=(obj.layer_id,)) + def get_routing_settings(self, obj): + data = [] + for settings in obj.routing_settings.all(): + label = settings.label + options = {} + if settings.provider == "Mapbox": + options["transit"] = settings.mapbox_transit + else: + options["url"] = reverse('layer-route', args=[settings.layer.pk]) + data.append({"label": label, + "provider": { + "name": settings.provider, + "options": options + } + }) + return data + class Meta: model = models.CrudView fields = ( @@ -130,7 +148,8 @@ class Meta: 'pictogram', 'order', 'map_style', 'form_schema', 'ui_schema', 'settings', 'layer', 'feature_endpoint', 'extent', 'exports', - 'feature_list_properties', 'map_layers' + 'feature_list_properties', 'map_layers', + 'routing_settings' ) diff --git a/terra_geocrud/tests/factories.py b/terra_geocrud/tests/factories.py index 6037f9ca..98f82cc3 100644 --- a/terra_geocrud/tests/factories.py +++ b/terra_geocrud/tests/factories.py @@ -3,7 +3,7 @@ from geostore import GeometryTypes from geostore.tests.factories import LayerFactory -from terra_geocrud.models import CrudView, FeaturePicture, AttachmentCategory, FeatureAttachment +from terra_geocrud.models import CrudView, FeaturePicture, AttachmentCategory, FeatureAttachment, RoutingSettings from terra_geocrud.tests.settings import DOCX_TEMPLATE, PDF_TEMPLATE @@ -90,3 +90,10 @@ def _create(cls, model_class, *args, **kwargs): kwargs.update({'password': kwargs.get('password', '123456')}) manager = cls._get_manager(model_class) return manager.create_user(*args, **kwargs) + + +class RoutingSettingsFactory(factory.django.DjangoModelFactory): + label = factory.Sequence(lambda n: "Label %03d" % n) + + class Meta: + model = RoutingSettings diff --git a/terra_geocrud/tests/test_views.py b/terra_geocrud/tests/test_views.py index 2307057a..a9b86b12 100644 --- a/terra_geocrud/tests/test_views.py +++ b/terra_geocrud/tests/test_views.py @@ -2,7 +2,7 @@ from django.contrib.gis.geos import Point from django.core.files.uploadedfile import SimpleUploadedFile -from django.test import TestCase +from django.test import tag, TestCase from django.test.utils import override_settings from django.urls import reverse from geostore import GeometryTypes @@ -11,7 +11,7 @@ from rest_framework.test import APITestCase from terra_geocrud.properties.schema import sync_layer_schema -from terra_geocrud.tests.factories import AttachmentCategoryFactory, UserFactory +from terra_geocrud.tests.factories import AttachmentCategoryFactory, UserFactory, RoutingSettingsFactory from terra_geocrud.models import CrudViewProperty, PropertyEnum from . import factories @@ -212,6 +212,20 @@ def test_property_enum_are_casted(self): self.assertListEqual(sorted(data['form_schema']['properties']['height2']['enum']), sorted([1.1, 2])) + @tag('routing', "Only routing ") + def test_routing_settings_crudview_detail(self): + RoutingSettingsFactory.create(provider="Mapbox", mapbox_transit="driving", crud_view=self.view_1) + RoutingSettingsFactory.create(provider="Geostore", layer=self.view_2.layer, crud_view=self.view_1) + response = self.client.get(reverse('crudview-detail', args=(self.view_1.pk,))) + self.assertEqual(response.status_code, status.HTTP_200_OK) + data = response.json() + routing_settings = data['routing_settings'] + + self.assertEqual(routing_settings[0]['provider']['name'], "Geostore") + self.assertEqual(routing_settings[0]['provider']['options']['url'], reverse('layer-route', args=[self.view_2.layer.pk])) + self.assertEqual(routing_settings[1]['provider']['name'], "Mapbox") + self.assertEqual(routing_settings[1]['provider']['options']["transit"], 'driving') + @override_settings(MEDIA_ROOT=TemporaryDirectory().name) class CrudSettingsViewTestCase(TestCase): From 4918024f19e9dbdb45f0bc8df81112910ef19336 Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Thu, 21 Jan 2021 16:47:33 +0100 Subject: [PATCH 13/28] Change model routingserializer --- terra_geocrud/models.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/terra_geocrud/models.py b/terra_geocrud/models.py index ef6be769..0556b4fb 100644 --- a/terra_geocrud/models.py +++ b/terra_geocrud/models.py @@ -352,12 +352,18 @@ class RoutingSettings(models.Model): label = models.CharField(max_length=250, help_text=_("Label that will be shown on the list")) provider = models.CharField(max_length=250, help_text=_("Provider's name"), choices=(("Mapbox", _("Mapbox")), ("Geostore", _("Geostore")))) - layer = models.OneToOneField('geostore.Layer', related_name='routing_settings', on_delete=models.CASCADE, null=True) + layer = models.ForeignKey('geostore.Layer', related_name='routing_settings', on_delete=models.PROTECT, blank=True) mapbox_transit = models.CharField(max_length=250, help_text=_("Mabox transit"), choices=(("Driving", _("Driving")), ("Walking", _("Walking")), ("Walking", _("Cycling")) - ), null=True) + ), blank=True) crud_view = models.ForeignKey(CrudView, related_name='routing_settings', on_delete=models.CASCADE) def __str__(self): return self.label + + class Meta: + unique_together = ( + ('label', 'crud_view'), + ('layer', 'crud_view'), + ) From 0d52da00c7d93087def1632b65e4ccd91e131ccf Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Thu, 21 Jan 2021 16:49:48 +0100 Subject: [PATCH 14/28] Add prefetch related routing settings --- terra_geocrud/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terra_geocrud/views.py b/terra_geocrud/views.py index cd9cc07d..e4bbee40 100644 --- a/terra_geocrud/views.py +++ b/terra_geocrud/views.py @@ -52,7 +52,7 @@ class CrudGroupViewSet(ReversionMixin, viewsets.ModelViewSet): class CrudViewViewSet(ReversionMixin, viewsets.ModelViewSet): - queryset = models.CrudView.objects.all() + queryset = models.CrudView.objects.prefetch_related('routing_settings') serializer_class = serializers.CrudViewSerializer From 8d1f8dc3692ac907c938affd163f3932dcc250bf Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Thu, 21 Jan 2021 16:55:41 +0100 Subject: [PATCH 15/28] Add migration --- .../migrations/0060_routingsettings.py | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 terra_geocrud/migrations/0060_routingsettings.py diff --git a/terra_geocrud/migrations/0060_routingsettings.py b/terra_geocrud/migrations/0060_routingsettings.py new file mode 100644 index 00000000..ba045c05 --- /dev/null +++ b/terra_geocrud/migrations/0060_routingsettings.py @@ -0,0 +1,29 @@ +# Generated by Django 3.1.5 on 2021-01-21 15:55 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('geostore', '0044_auto_20201106_1638'), + ('terra_geocrud', '0059_auto_20201022_0930'), + ] + + operations = [ + migrations.CreateModel( + name='RoutingSettings', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('label', models.CharField(help_text='Label that will be shown on the list', max_length=250)), + ('provider', models.CharField(choices=[('Mapbox', 'Mapbox'), ('Geostore', 'Geostore')], help_text="Provider's name", max_length=250)), + ('mapbox_transit', models.CharField(blank=True, choices=[('Driving', 'Driving'), ('Walking', 'Walking'), ('Walking', 'Cycling')], help_text='Mabox transit', max_length=250)), + ('crud_view', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='routing_settings', to='terra_geocrud.crudview')), + ('layer', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.PROTECT, related_name='routing_settings', to='geostore.layer')), + ], + options={ + 'unique_together': {('label', 'crud_view'), ('layer', 'crud_view')}, + }, + ), + ] From 7bb4b3f9c509a09cc7922f35ed24c678bb5f7d9b Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Thu, 21 Jan 2021 17:01:18 +0100 Subject: [PATCH 16/28] Add null True layer --- terra_geocrud/migrations/0060_routingsettings.py | 6 +++--- terra_geocrud/models.py | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/terra_geocrud/migrations/0060_routingsettings.py b/terra_geocrud/migrations/0060_routingsettings.py index ba045c05..e2906df5 100644 --- a/terra_geocrud/migrations/0060_routingsettings.py +++ b/terra_geocrud/migrations/0060_routingsettings.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2021-01-21 15:55 +# Generated by Django 3.1.5 on 2021-01-21 16:01 from django.db import migrations, models import django.db.models.deletion @@ -20,10 +20,10 @@ class Migration(migrations.Migration): ('provider', models.CharField(choices=[('Mapbox', 'Mapbox'), ('Geostore', 'Geostore')], help_text="Provider's name", max_length=250)), ('mapbox_transit', models.CharField(blank=True, choices=[('Driving', 'Driving'), ('Walking', 'Walking'), ('Walking', 'Cycling')], help_text='Mabox transit', max_length=250)), ('crud_view', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='routing_settings', to='terra_geocrud.crudview')), - ('layer', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.PROTECT, related_name='routing_settings', to='geostore.layer')), + ('layer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='routing_settings', to='geostore.layer')), ], options={ - 'unique_together': {('label', 'crud_view'), ('layer', 'crud_view')}, + 'unique_together': {('layer', 'crud_view'), ('label', 'crud_view')}, }, ), ] diff --git a/terra_geocrud/models.py b/terra_geocrud/models.py index 0556b4fb..5a7fcf61 100644 --- a/terra_geocrud/models.py +++ b/terra_geocrud/models.py @@ -352,7 +352,8 @@ class RoutingSettings(models.Model): label = models.CharField(max_length=250, help_text=_("Label that will be shown on the list")) provider = models.CharField(max_length=250, help_text=_("Provider's name"), choices=(("Mapbox", _("Mapbox")), ("Geostore", _("Geostore")))) - layer = models.ForeignKey('geostore.Layer', related_name='routing_settings', on_delete=models.PROTECT, blank=True) + layer = models.ForeignKey('geostore.Layer', related_name='routing_settings', on_delete=models.PROTECT, blank=True, + null=True) mapbox_transit = models.CharField(max_length=250, help_text=_("Mabox transit"), choices=(("Driving", _("Driving")), ("Walking", _("Walking")), ("Walking", _("Cycling")) From 111ee5377fdc864678ae42831720f8f89d1e24a1 Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Thu, 21 Jan 2021 17:35:36 +0100 Subject: [PATCH 17/28] Change choices --- .../migrations/0060_routingsettings.py | 29 ------------------- terra_geocrud/models.py | 10 +++---- 2 files changed, 5 insertions(+), 34 deletions(-) delete mode 100644 terra_geocrud/migrations/0060_routingsettings.py diff --git a/terra_geocrud/migrations/0060_routingsettings.py b/terra_geocrud/migrations/0060_routingsettings.py deleted file mode 100644 index e2906df5..00000000 --- a/terra_geocrud/migrations/0060_routingsettings.py +++ /dev/null @@ -1,29 +0,0 @@ -# Generated by Django 3.1.5 on 2021-01-21 16:01 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('geostore', '0044_auto_20201106_1638'), - ('terra_geocrud', '0059_auto_20201022_0930'), - ] - - operations = [ - migrations.CreateModel( - name='RoutingSettings', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('label', models.CharField(help_text='Label that will be shown on the list', max_length=250)), - ('provider', models.CharField(choices=[('Mapbox', 'Mapbox'), ('Geostore', 'Geostore')], help_text="Provider's name", max_length=250)), - ('mapbox_transit', models.CharField(blank=True, choices=[('Driving', 'Driving'), ('Walking', 'Walking'), ('Walking', 'Cycling')], help_text='Mabox transit', max_length=250)), - ('crud_view', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='routing_settings', to='terra_geocrud.crudview')), - ('layer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='routing_settings', to='geostore.layer')), - ], - options={ - 'unique_together': {('layer', 'crud_view'), ('label', 'crud_view')}, - }, - ), - ] diff --git a/terra_geocrud/models.py b/terra_geocrud/models.py index 5a7fcf61..908b3c67 100644 --- a/terra_geocrud/models.py +++ b/terra_geocrud/models.py @@ -350,13 +350,13 @@ class Meta: class RoutingSettings(models.Model): label = models.CharField(max_length=250, help_text=_("Label that will be shown on the list")) - provider = models.CharField(max_length=250, help_text=_("Provider's name"), choices=(("Mapbox", _("Mapbox")), - ("Geostore", _("Geostore")))) + provider = models.CharField(max_length=250, help_text=_("Provider's name"), choices=(("mapbox", _("Mapbox")), + ("geostore", _("Geostore")))) layer = models.ForeignKey('geostore.Layer', related_name='routing_settings', on_delete=models.PROTECT, blank=True, null=True) - mapbox_transit = models.CharField(max_length=250, help_text=_("Mabox transit"), choices=(("Driving", _("Driving")), - ("Walking", _("Walking")), - ("Walking", _("Cycling")) + mapbox_transit = models.CharField(max_length=250, help_text=_("Mabox transit"), choices=(("driving", _("Driving")), + ("walking", _("Walking")), + ("cycling", _("Cycling")) ), blank=True) crud_view = models.ForeignKey(CrudView, related_name='routing_settings', on_delete=models.CASCADE) From 4d9a88d8fb229ed1c1c77033cc50ab46f3aa471e Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Fri, 22 Jan 2021 10:37:50 +0100 Subject: [PATCH 18/28] Change migration --- .../migrations/0060_routingsettings.py | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 terra_geocrud/migrations/0060_routingsettings.py diff --git a/terra_geocrud/migrations/0060_routingsettings.py b/terra_geocrud/migrations/0060_routingsettings.py new file mode 100644 index 00000000..21a76ff6 --- /dev/null +++ b/terra_geocrud/migrations/0060_routingsettings.py @@ -0,0 +1,29 @@ +# Generated by Django 3.1.5 on 2021-01-21 16:22 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('geostore', '0044_auto_20201106_1638'), + ('terra_geocrud', '0059_auto_20201022_0930'), + ] + + operations = [ + migrations.CreateModel( + name='RoutingSettings', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('label', models.CharField(help_text='Label that will be shown on the list', max_length=250)), + ('provider', models.CharField(choices=[('mapbox', 'Mapbox'), ('geostore', 'Geostore')], help_text="Provider's name", max_length=250)), + ('mapbox_transit', models.CharField(blank=True, choices=[('driving', 'Driving'), ('walking', 'Walking'), ('cycling', 'Cycling')], help_text='Mabox transit', max_length=250)), + ('crud_view', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='routing_settings', to='terra_geocrud.crudview')), + ('layer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='routing_settings', to='geostore.layer')), + ], + options={ + 'unique_together': {('layer', 'crud_view'), ('label', 'crud_view')}, + }, + ), + ] From 27cd5444b2bf1e343a4a0b454ea2168df1d77ea4 Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Fri, 22 Jan 2021 10:39:02 +0100 Subject: [PATCH 19/28] Add ValidationError, change tests, add tests models --- terra_geocrud/models.py | 28 ++++++++++++++++ terra_geocrud/serializers.py | 12 +++---- terra_geocrud/tests/test_models.py | 53 +++++++++++++++++++++++++++++- terra_geocrud/tests/test_views.py | 19 +++++++---- 4 files changed, 99 insertions(+), 13 deletions(-) diff --git a/terra_geocrud/models.py b/terra_geocrud/models.py index 908b3c67..cde4c8e9 100644 --- a/terra_geocrud/models.py +++ b/terra_geocrud/models.py @@ -368,3 +368,31 @@ class Meta: ('label', 'crud_view'), ('layer', 'crud_view'), ) + + + def clean(self): + layer = self.layer + mapbox_transit = self.mapbox_transit + provider = self.provider + + if layer: + if not layer.routable: + raise ValidationError( + _("You should define layer with a routable layer") + ) + if mapbox_transit and layer: + raise ValidationError( + _("You shouldn't define layer and mapbox_transit") + ) + if provider == "mapbox" and layer or provider == "geostore" and mapbox_transit: + raise ValidationError( + _("You use the wrong provider") + ) + if provider == "mapbox" and not mapbox_transit: + raise ValidationError( + _("You should define a mapbox_transit with this provider") + ) + if provider == "geostore" and not layer: + raise ValidationError( + _("You should define a layer with this provider") + ) diff --git a/terra_geocrud/serializers.py b/terra_geocrud/serializers.py index ebbfecb4..c42f017b 100644 --- a/terra_geocrud/serializers.py +++ b/terra_geocrud/serializers.py @@ -126,16 +126,16 @@ def get_feature_endpoint(self, obj): def get_routing_settings(self, obj): data = [] - for settings in obj.routing_settings.all(): - label = settings.label + for routing_setting in obj.routing_settings.all(): + label = routing_setting.label options = {} - if settings.provider == "Mapbox": - options["transit"] = settings.mapbox_transit + if routing_setting.provider == "mapbox": + options["transit"] = routing_setting.mapbox_transit else: - options["url"] = reverse('layer-route', args=[settings.layer.pk]) + options["url"] = reverse('layer-route', args=[routing_setting.layer.pk]) data.append({"label": label, "provider": { - "name": settings.provider, + "name": routing_setting.provider, "options": options } }) diff --git a/terra_geocrud/tests/test_models.py b/terra_geocrud/tests/test_models.py index 0d1c01ef..52910b44 100644 --- a/terra_geocrud/tests/test_models.py +++ b/terra_geocrud/tests/test_models.py @@ -5,12 +5,14 @@ from django.test import override_settings from django.test.testcases import TestCase from geostore.models import Feature +from geostore.tests.factories import LayerFactory from terra_geocrud.models import AttachmentCategory, feature_attachment_directory_path, \ feature_picture_directory_path, CrudViewProperty, FeatureAttachment, PropertyEnum from terra_geocrud.properties.files import get_storage from terra_geocrud.tests import factories -from terra_geocrud.tests.factories import CrudViewFactory, FeaturePictureFactory, FeatureAttachmentFactory +from terra_geocrud.tests.factories import CrudViewFactory, FeaturePictureFactory, FeatureAttachmentFactory, \ + RoutingSettingsFactory from .. import models from ..properties.schema import sync_layer_schema, sync_ui_schema @@ -245,3 +247,52 @@ def test_bad_integer_value(self): def test_str(self): prop = PropertyEnum(value="France", property=self.prop_1) self.assertEqual(str(prop), "France") + + +class RoutingSettingsTestCase(TestCase): + @classmethod + def setUpTestData(cls): + cls.layer = LayerFactory(routable=True) + cls.crud_view = factories.CrudViewFactory() + cls.settings = RoutingSettingsFactory.create(provider="geostore", layer=cls.layer, + crud_view=cls.crud_view) + + def test_str(self): + setting = RoutingSettingsFactory.create(provider="mapbox", mapbox_transit="driving", + crud_view=self.crud_view, label="MapBox Driving") + self.assertEqual(str(setting), "MapBox Driving") + + def test_provider_mapbox_with_layer(self): + setting = RoutingSettingsFactory.create(provider="mapbox", layer=self.crud_view.layer, + crud_view=self.crud_view) + with self.assertRaises(ValidationError): + setting.clean() + + def test_provider_geostore_with_transit(self): + setting = RoutingSettingsFactory.create(provider="geostore", mapbox_transit='cycling', + crud_view=self.crud_view) + with self.assertRaises(ValidationError): + setting.clean() + + def test_provider_mapbox_without_transit(self): + setting = RoutingSettingsFactory.create(provider="mapbox", crud_view=self.crud_view) + with self.assertRaises(ValidationError): + setting.clean() + + def test_provider_geostore_without_layer(self): + setting = RoutingSettingsFactory.create(provider="geostore", crud_view=self.crud_view) + with self.assertRaises(ValidationError): + setting.clean() + + def test_provider_with_layer_transit(self): + layer = LayerFactory(routable=False) + setting = RoutingSettingsFactory.create(provider="geostore", mapbox_transit='cycling', + layer=self.crud_view.layer, crud_view=self.crud_view) + with self.assertRaises(ValidationError): + setting.clean() + + def test_layer_not_routable(self): + layer = LayerFactory(routable=False) + setting = RoutingSettingsFactory.create(provider="geostore", layer=layer, crud_view=self.crud_view) + with self.assertRaises(ValidationError): + setting.clean() diff --git a/terra_geocrud/tests/test_views.py b/terra_geocrud/tests/test_views.py index a9b86b12..87967d93 100644 --- a/terra_geocrud/tests/test_views.py +++ b/terra_geocrud/tests/test_views.py @@ -212,19 +212,26 @@ def test_property_enum_are_casted(self): self.assertListEqual(sorted(data['form_schema']['properties']['height2']['enum']), sorted([1.1, 2])) - @tag('routing', "Only routing ") def test_routing_settings_crudview_detail(self): - RoutingSettingsFactory.create(provider="Mapbox", mapbox_transit="driving", crud_view=self.view_1) - RoutingSettingsFactory.create(provider="Geostore", layer=self.view_2.layer, crud_view=self.view_1) + RoutingSettingsFactory.create(provider="mapbox", mapbox_transit="driving", crud_view=self.view_1) response = self.client.get(reverse('crudview-detail', args=(self.view_1.pk,))) self.assertEqual(response.status_code, status.HTTP_200_OK) data = response.json() routing_settings = data['routing_settings'] - self.assertEqual(routing_settings[0]['provider']['name'], "Geostore") + self.assertEqual(routing_settings[0]['provider']['name'], "mapbox") + self.assertEqual(routing_settings[0]['provider']['options']["transit"], 'driving') + + @tag('routing', "Only geostore routing") + def test_routing_settings_geostorecrudview_detail(self): + RoutingSettingsFactory.create(provider="geostore", layer=self.view_2.layer, crud_view=self.view_1) + response = self.client.get(reverse('crudview-detail', args=(self.view_1.pk,))) + self.assertEqual(response.status_code, status.HTTP_200_OK) + data = response.json() + routing_settings = data['routing_settings'] + + self.assertEqual(routing_settings[0]['provider']['name'], "geostore") self.assertEqual(routing_settings[0]['provider']['options']['url'], reverse('layer-route', args=[self.view_2.layer.pk])) - self.assertEqual(routing_settings[1]['provider']['name'], "Mapbox") - self.assertEqual(routing_settings[1]['provider']['options']["transit"], 'driving') @override_settings(MEDIA_ROOT=TemporaryDirectory().name) From e7f647070cd39882446a9434bf1f621442579455 Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Fri, 22 Jan 2021 11:44:07 +0100 Subject: [PATCH 20/28] Add admin routing settings --- terra_geocrud/admin.py | 11 +++++++++- terra_geocrud/forms.py | 20 +++++++++++++++++-- .../migrations/0060_routingsettings.py | 4 ++-- terra_geocrud/models.py | 7 +++++-- 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/terra_geocrud/admin.py b/terra_geocrud/admin.py index 8292c9a6..01607b2b 100644 --- a/terra_geocrud/admin.py +++ b/terra_geocrud/admin.py @@ -72,6 +72,15 @@ class CrudPropertyInline(OrderableAdmin, NestedTabularInline): inlines = [PropertyEnumInline, ] +class RoutingSettingsInLine(NestedTabularInline): + classes = ('collapse',) + verbose_name = _('Routing setting') + verbose_name_plural = _('Routing settings') + model = models.RoutingSettings + extra = 0 + form = forms.RoutingSettingsForm + + @admin_thumbnails.thumbnail('pictogram') class CrudViewAdmin(OrderableAdmin, DjangoObjectActions, VersionAdmin, NestedModelAdmin): ordering_field = "order" @@ -80,7 +89,7 @@ class CrudViewAdmin(OrderableAdmin, DjangoObjectActions, VersionAdmin, NestedMod form = forms.CrudViewForm list_display = ['name', 'group', 'order', 'pictogram_thumbnail'] list_filter = ['group', ] - inlines = [FeatureDisplayGroupTabularInline, CrudPropertyInline, ExtraLayerStyleInLine] + inlines = [FeatureDisplayGroupTabularInline, CrudPropertyInline, ExtraLayerStyleInLine, RoutingSettingsInLine] readonly_fields = ('ui_schema', ) fieldsets = ( (None, {'fields': (('name', 'object_name', 'object_name_plural', 'layer'), ('group', 'order', 'pictogram', 'pictogram_thumbnail'))}), diff --git a/terra_geocrud/forms.py b/terra_geocrud/forms.py index 5e953046..b81886e7 100644 --- a/terra_geocrud/forms.py +++ b/terra_geocrud/forms.py @@ -1,13 +1,14 @@ import tempfile from django import forms +from django.conf import settings from django.contrib.gis.forms import GeometryField from django.contrib.gis.gdal import DataSource from django.utils.translation import gettext as _ -from geostore.models import FeatureExtraGeom +from geostore.models import FeatureExtraGeom, Layer from . import models -from .models import CrudView +from .models import CrudView, RoutingSettings def parse_geometry_file(geom_file): @@ -93,3 +94,18 @@ def save(self, commit=True): class Meta: model = FeatureExtraGeom fields = "__all__" + + +class RoutingSettingsForm(forms.ModelForm): + layer = forms.ModelChoiceField(queryset=Layer.objects.filter(routable=True), required=False) + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + if 'geostore_routing' not in settings.INSTALLED_APPS: + self.fields['layer'].widget = forms.HiddenInput() + self.fields['provider'] = forms.ChoiceField(choices=RoutingSettings.CHOICES_EXTERNAL, + required=True) + + class Meta: + model = RoutingSettings + fields = "__all__" diff --git a/terra_geocrud/migrations/0060_routingsettings.py b/terra_geocrud/migrations/0060_routingsettings.py index 21a76ff6..d5c6c820 100644 --- a/terra_geocrud/migrations/0060_routingsettings.py +++ b/terra_geocrud/migrations/0060_routingsettings.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2021-01-21 16:22 +# Generated by Django 3.1.5 on 2021-01-22 10:42 from django.db import migrations, models import django.db.models.deletion @@ -23,7 +23,7 @@ class Migration(migrations.Migration): ('layer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='routing_settings', to='geostore.layer')), ], options={ - 'unique_together': {('layer', 'crud_view'), ('label', 'crud_view')}, + 'unique_together': {('provider', 'mapbox_transit'), ('label', 'crud_view'), ('provider', 'layer'), ('layer', 'crud_view')}, }, ), ] diff --git a/terra_geocrud/models.py b/terra_geocrud/models.py index cde4c8e9..db8f1e97 100644 --- a/terra_geocrud/models.py +++ b/terra_geocrud/models.py @@ -349,9 +349,10 @@ class Meta: class RoutingSettings(models.Model): + CHOICES_EXTERNAL = (("mapbox", _("Mapbox")), ) + CHOICES = CHOICES_EXTERNAL + (("geostore", _("Geostore")), ) label = models.CharField(max_length=250, help_text=_("Label that will be shown on the list")) - provider = models.CharField(max_length=250, help_text=_("Provider's name"), choices=(("mapbox", _("Mapbox")), - ("geostore", _("Geostore")))) + provider = models.CharField(max_length=250, help_text=_("Provider's name"), choices=CHOICES) layer = models.ForeignKey('geostore.Layer', related_name='routing_settings', on_delete=models.PROTECT, blank=True, null=True) mapbox_transit = models.CharField(max_length=250, help_text=_("Mabox transit"), choices=(("driving", _("Driving")), @@ -367,6 +368,8 @@ class Meta: unique_together = ( ('label', 'crud_view'), ('layer', 'crud_view'), + ('provider', 'mapbox_transit'), + ('provider', 'layer') ) From c97e319d4131fd1e75aced64b3f03041355ed704 Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Fri, 22 Jan 2021 12:38:43 +0100 Subject: [PATCH 21/28] Change ci --- .github/workflows/python-package.yml | 4 +-- .../migrations/0060_routingsettings.py | 29 ------------------- 2 files changed, 2 insertions(+), 31 deletions(-) delete mode 100644 terra_geocrud/migrations/0060_routingsettings.py diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index a88e677d..09916c97 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -29,11 +29,11 @@ jobs: experimental: true python-version: 3.8 postgres: 'pgrouting/pgrouting:10-2.5-2.6.3' - - django-version: 3.2 + - django-version: 3.2a1 experimental: true python-version: 3.8 postgres: 'postgis/postgis:10-2.5' - - django-version: 3.2 + - django-version: 3.2a1 experimental: true python-version: 3.8 postgres: 'pgrouting/pgrouting:10-2.5-2.6.3' diff --git a/terra_geocrud/migrations/0060_routingsettings.py b/terra_geocrud/migrations/0060_routingsettings.py deleted file mode 100644 index d5c6c820..00000000 --- a/terra_geocrud/migrations/0060_routingsettings.py +++ /dev/null @@ -1,29 +0,0 @@ -# Generated by Django 3.1.5 on 2021-01-22 10:42 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('geostore', '0044_auto_20201106_1638'), - ('terra_geocrud', '0059_auto_20201022_0930'), - ] - - operations = [ - migrations.CreateModel( - name='RoutingSettings', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('label', models.CharField(help_text='Label that will be shown on the list', max_length=250)), - ('provider', models.CharField(choices=[('mapbox', 'Mapbox'), ('geostore', 'Geostore')], help_text="Provider's name", max_length=250)), - ('mapbox_transit', models.CharField(blank=True, choices=[('driving', 'Driving'), ('walking', 'Walking'), ('cycling', 'Cycling')], help_text='Mabox transit', max_length=250)), - ('crud_view', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='routing_settings', to='terra_geocrud.crudview')), - ('layer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='routing_settings', to='geostore.layer')), - ], - options={ - 'unique_together': {('provider', 'mapbox_transit'), ('label', 'crud_view'), ('provider', 'layer'), ('layer', 'crud_view')}, - }, - ), - ] From 362f7fb1d8fc9ccb42e38a6811f495a962aa0d60 Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Fri, 22 Jan 2021 12:40:24 +0100 Subject: [PATCH 22/28] Fix constraint, fix tests --- .../migrations/0060_auto_20210122_1132.py | 38 +++++++++++++++++++ terra_geocrud/models.py | 12 ++++-- terra_geocrud/tests/test_models.py | 4 +- 3 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 terra_geocrud/migrations/0060_auto_20210122_1132.py diff --git a/terra_geocrud/migrations/0060_auto_20210122_1132.py b/terra_geocrud/migrations/0060_auto_20210122_1132.py new file mode 100644 index 00000000..c630746e --- /dev/null +++ b/terra_geocrud/migrations/0060_auto_20210122_1132.py @@ -0,0 +1,38 @@ +# Generated by Django 3.1.5 on 2021-01-22 11:32 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('geostore', '0044_auto_20201106_1638'), + ('terra_geocrud', '0059_auto_20201022_0930'), + ] + + operations = [ + migrations.CreateModel( + name='RoutingSettings', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('label', models.CharField(help_text='Label that will be shown on the list', max_length=250)), + ('provider', models.CharField(choices=[('mapbox', 'Mapbox'), ('geostore', 'Geostore')], help_text="Provider's name", max_length=250)), + ('mapbox_transit', models.CharField(blank=True, choices=[('driving', 'Driving'), ('walking', 'Walking'), ('cycling', 'Cycling')], help_text='Mabox transit', max_length=250)), + ('crud_view', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='routing_settings', to='terra_geocrud.crudview')), + ('layer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='routing_settings', to='geostore.layer')), + ], + ), + migrations.AddConstraint( + model_name='routingsettings', + constraint=models.UniqueConstraint(condition=models.Q(layer__isnull=False), fields=('provider', 'layer'), name='check_provider_layer'), + ), + migrations.AddConstraint( + model_name='routingsettings', + constraint=models.UniqueConstraint(condition=models.Q(_negated=True, mapbox_transit=''), fields=('provider', 'mapbox_transit'), name='check_provider_mapbox_transit'), + ), + migrations.AlterUniqueTogether( + name='routingsettings', + unique_together={('label', 'crud_view'), ('layer', 'crud_view')}, + ), + ] diff --git a/terra_geocrud/models.py b/terra_geocrud/models.py index db8f1e97..54cb15b5 100644 --- a/terra_geocrud/models.py +++ b/terra_geocrud/models.py @@ -11,6 +11,7 @@ from django.contrib.postgres.fields import JSONField from django.contrib.postgres.indexes import GinIndex from django.db import models +from django.db.models import UniqueConstraint, Q from django.utils.functional import cached_property from django.utils.text import slugify from django.utils.translation import gettext_lazy as _ @@ -368,10 +369,15 @@ class Meta: unique_together = ( ('label', 'crud_view'), ('layer', 'crud_view'), - ('provider', 'mapbox_transit'), - ('provider', 'layer') ) - + constraints = [ + UniqueConstraint(fields=['provider', 'layer'], condition=Q(layer__isnull=False), + name='check_provider_layer' + ), + UniqueConstraint(fields=['provider', 'mapbox_transit'], condition=~Q(mapbox_transit=''), + name='check_provider_mapbox_transit' + ), + ] def clean(self): layer = self.layer diff --git a/terra_geocrud/tests/test_models.py b/terra_geocrud/tests/test_models.py index 52910b44..88863b75 100644 --- a/terra_geocrud/tests/test_models.py +++ b/terra_geocrud/tests/test_models.py @@ -263,7 +263,7 @@ def test_str(self): self.assertEqual(str(setting), "MapBox Driving") def test_provider_mapbox_with_layer(self): - setting = RoutingSettingsFactory.create(provider="mapbox", layer=self.crud_view.layer, + setting = RoutingSettingsFactory.create(provider="mapbox", layer=self.layer, crud_view=self.crud_view) with self.assertRaises(ValidationError): setting.clean() @@ -287,7 +287,7 @@ def test_provider_geostore_without_layer(self): def test_provider_with_layer_transit(self): layer = LayerFactory(routable=False) setting = RoutingSettingsFactory.create(provider="geostore", mapbox_transit='cycling', - layer=self.crud_view.layer, crud_view=self.crud_view) + layer=layer, crud_view=self.crud_view) with self.assertRaises(ValidationError): setting.clean() From 61db10a9c7f9af738f7a2600e9b9219a3e59fab1 Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Fri, 22 Jan 2021 12:45:14 +0100 Subject: [PATCH 23/28] Remove setup data setting --- terra_geocrud/tests/test_models.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/terra_geocrud/tests/test_models.py b/terra_geocrud/tests/test_models.py index 88863b75..40faf3a0 100644 --- a/terra_geocrud/tests/test_models.py +++ b/terra_geocrud/tests/test_models.py @@ -254,8 +254,6 @@ class RoutingSettingsTestCase(TestCase): def setUpTestData(cls): cls.layer = LayerFactory(routable=True) cls.crud_view = factories.CrudViewFactory() - cls.settings = RoutingSettingsFactory.create(provider="geostore", layer=cls.layer, - crud_view=cls.crud_view) def test_str(self): setting = RoutingSettingsFactory.create(provider="mapbox", mapbox_transit="driving", From 37f3b542c11189a198783c65ac6aadbb7833f0a8 Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Fri, 22 Jan 2021 12:52:31 +0100 Subject: [PATCH 24/28] Fix test validation error --- terra_geocrud/tests/test_models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terra_geocrud/tests/test_models.py b/terra_geocrud/tests/test_models.py index 40faf3a0..3a4c77c8 100644 --- a/terra_geocrud/tests/test_models.py +++ b/terra_geocrud/tests/test_models.py @@ -282,8 +282,8 @@ def test_provider_geostore_without_layer(self): with self.assertRaises(ValidationError): setting.clean() - def test_provider_with_layer_transit(self): - layer = LayerFactory(routable=False) + def test_provider_with_layer_and_transit(self): + layer = LayerFactory(routable=True) setting = RoutingSettingsFactory.create(provider="geostore", mapbox_transit='cycling', layer=layer, crud_view=self.crud_view) with self.assertRaises(ValidationError): From 0fd5cffe89cf689f733cbd84dc57b8af0864eb2f Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Fri, 22 Jan 2021 14:47:37 +0100 Subject: [PATCH 25/28] Add Validation error for same transit layer --- terra_geocrud/models.py | 24 ++++++++++++++---------- terra_geocrud/tests/test_models.py | 23 +++++++++++++++++++++++ 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/terra_geocrud/models.py b/terra_geocrud/models.py index 54cb15b5..b205b590 100644 --- a/terra_geocrud/models.py +++ b/terra_geocrud/models.py @@ -380,28 +380,32 @@ class Meta: ] def clean(self): - layer = self.layer - mapbox_transit = self.mapbox_transit - provider = self.provider - - if layer: - if not layer.routable: + if self.layer: + if not self.layer.routable: raise ValidationError( _("You should define layer with a routable layer") ) - if mapbox_transit and layer: + if self.mapbox_transit and self.layer: raise ValidationError( _("You shouldn't define layer and mapbox_transit") ) - if provider == "mapbox" and layer or provider == "geostore" and mapbox_transit: + if self.provider == "mapbox" and self.layer or self.provider == "geostore" and self.mapbox_transit: raise ValidationError( _("You use the wrong provider") ) - if provider == "mapbox" and not mapbox_transit: + if self.provider == "mapbox" and not self.mapbox_transit: raise ValidationError( _("You should define a mapbox_transit with this provider") ) - if provider == "geostore" and not layer: + if self.provider == "geostore" and not self.layer: raise ValidationError( _("You should define a layer with this provider") ) + if RoutingSettings.objects.filter(Q(mapbox_transit=self.mapbox_transit) & ~Q(mapbox_transit='')).exclude(label=self.label): + raise ValidationError( + _("This transit is already used") + ) + if RoutingSettings.objects.filter(Q(layer=self.layer) & Q(layer__isnull=False)).exclude(label=self.label): + raise ValidationError( + _("This layer is already used") + ) diff --git a/terra_geocrud/tests/test_models.py b/terra_geocrud/tests/test_models.py index 3a4c77c8..a4281617 100644 --- a/terra_geocrud/tests/test_models.py +++ b/terra_geocrud/tests/test_models.py @@ -2,6 +2,7 @@ from django.contrib.gis.geos import Point from django.core.exceptions import ValidationError +from django.db.utils import IntegrityError from django.test import override_settings from django.test.testcases import TestCase from geostore.models import Feature @@ -294,3 +295,25 @@ def test_layer_not_routable(self): setting = RoutingSettingsFactory.create(provider="geostore", layer=layer, crud_view=self.crud_view) with self.assertRaises(ValidationError): setting.clean() + + def test_same_transit_clean(self): + RoutingSettingsFactory.create(provider="mapbox", mapbox_transit='cycling', crud_view=self.crud_view) + setting = RoutingSettingsFactory.build(provider="mapbox", mapbox_transit='cycling', crud_view=self.crud_view) + with self.assertRaisesRegex(ValidationError, 'This transit is already used'): + setting.clean() + + def test_same_layer_clean(self): + RoutingSettingsFactory.create(provider="geostore", layer=self.layer, crud_view=self.crud_view) + setting = RoutingSettingsFactory.build(provider="geostore", layer=self.layer, crud_view=self.crud_view) + with self.assertRaisesRegex(ValidationError, 'This layer is already used'): + setting.clean() + + def test_same_transit(self): + RoutingSettingsFactory.create(provider="mapbox", mapbox_transit='cycling', crud_view=self.crud_view) + with self.assertRaises(IntegrityError): + RoutingSettingsFactory.create(provider="mapbox", mapbox_transit='cycling', crud_view=self.crud_view) + + def test_same_layer(self): + RoutingSettingsFactory.create(provider="geostore", layer=self.layer, crud_view=self.crud_view) + with self.assertRaises(IntegrityError): + RoutingSettingsFactory.create(provider="geostore", layer=self.layer, crud_view=self.crud_view) From b8651c934d007f0bc91574e662454d6ef1d39c70 Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Fri, 22 Jan 2021 14:49:02 +0100 Subject: [PATCH 26/28] Change condition routable --- terra_geocrud/models.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/terra_geocrud/models.py b/terra_geocrud/models.py index b205b590..6a6f82c9 100644 --- a/terra_geocrud/models.py +++ b/terra_geocrud/models.py @@ -380,11 +380,10 @@ class Meta: ] def clean(self): - if self.layer: - if not self.layer.routable: - raise ValidationError( - _("You should define layer with a routable layer") - ) + if self.layer and not self.layer.routable: + raise ValidationError( + _("You should define layer with a routable layer") + ) if self.mapbox_transit and self.layer: raise ValidationError( _("You shouldn't define layer and mapbox_transit") From 5e1447431246a3c9591ae073ba0201175579f99f Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Fri, 22 Jan 2021 15:19:51 +0100 Subject: [PATCH 27/28] Add traduciton, add compile messages --- terra_geocrud/locale/en/LC_MESSAGES/django.po | 64 +++++++++++-- terra_geocrud/locale/fr/LC_MESSAGES/django.mo | Bin 6880 -> 7110 bytes terra_geocrud/locale/fr/LC_MESSAGES/django.po | 88 ++++++++++++++++-- 3 files changed, 138 insertions(+), 14 deletions(-) diff --git a/terra_geocrud/locale/en/LC_MESSAGES/django.po b/terra_geocrud/locale/en/LC_MESSAGES/django.po index d928d776..abd00d07 100644 --- a/terra_geocrud/locale/en/LC_MESSAGES/django.po +++ b/terra_geocrud/locale/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-22 09:29+0000\n" +"POT-Creation-Date: 2021-01-22 14:11+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -42,6 +42,12 @@ msgstr "" msgid "Feature properties" msgstr "" +msgid "Routing setting" +msgstr "" + +msgid "Routing settings" +msgstr "" + msgid "UI schema & properties" msgstr "" @@ -101,20 +107,19 @@ msgstr "" msgid "Geographic Editor Config" msgstr "" -msgid "" -"GEOCRUD: Can create / edit / delete views / groups and associated layers." +msgid "CRUD: Can create / edit / delete views / groups and associated layers." msgstr "" -msgid "GEOCRUD: Can read feature detail." +msgid "CRUD: Can read feature detail." msgstr "" -msgid "GEOCRUD: Can create feature" +msgid "CRUD: Can create feature" msgstr "" -msgid "GEOCRUD: Can change feature" +msgid "CRUD: Can change feature" msgstr "" -msgid "GEOCRUD: Can delete feature" +msgid "CRUD: Can delete feature" msgstr "" msgid "You should define geometry with drawing or file." @@ -233,6 +238,51 @@ msgid "" "json_schema.get('type')})" msgstr "" +msgid "Mapbox" +msgstr "" + +msgid "Geostore" +msgstr "" + +msgid "Label that will be shown on the list" +msgstr "" + +msgid "Provider's name" +msgstr "" + +msgid "Mabox transit" +msgstr "" + +msgid "Driving" +msgstr "" + +msgid "Walking" +msgstr "" + +msgid "Cycling" +msgstr "" + +msgid "You should define layer with a routable layer" +msgstr "" + +msgid "You shouldn't define layer and mapbox_transit" +msgstr "" + +msgid "You use the wrong provider" +msgstr "" + +msgid "You should define a mapbox_transit with this provider" +msgstr "" + +msgid "You should define a layer with this provider" +msgstr "" + +msgid "This transit is already used" +msgstr "" + +msgid "This layer is already used" +msgstr "" + msgid "VT styles and definitions" msgstr "" diff --git a/terra_geocrud/locale/fr/LC_MESSAGES/django.mo b/terra_geocrud/locale/fr/LC_MESSAGES/django.mo index 99e6c33d99a0b6b73e1a1551aed79b97a19fee42..3f13bcb342d5730a9112d71872bf9d4a3dd39b61 100644 GIT binary patch delta 2395 zcmZwHTWl0n9LMpqv~+>|*HG3{vdEC%;64wzY#~G8vwd47q{ZVDiB>WSn<7J$N(XcVqxDdBs3$DSV zW#7hDzMsc>Ts*;;dDw|3&_#aAn#zgB%;H7_+pz&Bs{^jY5v;@4P!pfQD1L(sV1CDI z@Gq>vFxgJUT2#LV)bDNO``gO*@5O1%Zw_)Xg$~D19gmkgyo?s#-@&=~H7>x*sD5)< z{!DB^7Gt)eiq?&@@h+rT<`Aj^S=93}%yAqhsM=iFX`fWxFdr(_9f=c`e+>cM;61-TW{pX^AEYzV1mHBd9if!10 z3Dm?VFcvcAEhGo?H~VlshS_kHd?E6a>A+s>MxCKk7{lMN6PHnrMm!Xy{u=lNZaj?d zqY~M|Nn3$CP!AqMmGCUKiJ6c=O(O1CAb=O z7_;qM+{lH4lf_C2uE8bvvDg1xDG!=4fHQ|;4Ge2g8R|J6zVKIhI8HXi$g~yG%Q5`--tt`ZBI-KKC8Bf9;I2AWwFDmgDF@$PeC5oR~ zy(ZQobl6l?HI1ROvqfL@{;wrSs(7%VIO$ScPH5%YckR_ULMyzospM+g2ntv{?HhH2 zrfu0tScICkaW%1t&>7M;WwlZrm^MOfF`@Hto4(Mr6-$Vl302`%Vyv}tv6)acI>&Ba zq4rx98f)9j7dn`$2nv@i?h*eF%q;}3XR)o}vx(4wsaYQZzN@TDegK}!c7OcH>&ql_j-q{ zz_(LrH^@aIbyZ#V5Vvv*B419~;d{ew-0>Hst(2W~au*^Wtr~RGR>D5)_!bv-!guWW zVJnk%;-*_al}Ebz$NZ_uQ$yi9?Zkab{Y*{EroCQ931t%T)S|$OJN<5oq>2OEskoIa zX0fk4oKbHkDP}(6d#M3ysGM8=V$G8k<9iCD2`~Rhv^f;+@!TNeJNb8~?G5GrnLekg zRFhnNZC_*Ip};+uae~0H4rW{{?fAB3_xHPfgN0G*lkv%*RGA~S1CzV#D{J#ZZF8k+ zlaI`33PrbjNh_YQ`n`;wa?@!ibH6oYr!^p@a+Rqz!3nM^mF1+YWZ~5$ a^Ek<&v?-2Inw}974&5`uHaj&|K=U7DFaA&oHevQqLxVJ7-Qp?D>%?b@{G9~gIIwPEW;PE5YOR$Jdd4t({pRS zG3{KB;yRqg4frm;j^AR9F=>;$%b0F%oWf$fhHdygR%1oM!hp@VhHF2r!oygC+!?;V^2z8Dz%h4DQ2=-u3UE z<)lOJwcuJjge&oBya%5_l4DMyGICDO8Q)yuWDws&WuUmo80KVZP`glv`cOUU!!4+l z??Y|b5Ncv6B&+5$l05SoDr4tS175~DyoybD3)799)G=x~4&WX)}vD2fm*;})PzH*Oe9fz{X8m@Gq?dypvJp|t@urv6Sm#t zGrBsI;Q;PL71MFl3m32vuc9XO7ixf7_N4(gqV~QYRkTCMr_Bp^0M8(QW}XADn%kI* z>C&o&-**{q<;Hp>%O-%EaR^mhY1GPQQ3Jn$+WWUq6TO0uhCg`E53&zh!AqzjJC6N$5~(fspBB63 zPUaD0UT&?Z&YFq)i3a`t)#?d~(%nN1)=exn{gl)!LN&42w2Ftk3r$#UKcVeu(*;di z5OB{HCaXQyA{Sea#@BwRZ!YDWL8dI{Bmig*k0 zAkj{!7}+sXo4J`+mE#l@%x7*DbotV~2mFTydpa$DFlvn+2}Z|lYs?NNQ*qk_{`D-* zUE6B5>`*ufAvj9LkEJFPRxlc}f{8?IG)(7^6$wt;@kG9(k)d($>\n" "Language-Team: LANGUAGE \n" @@ -42,6 +42,16 @@ msgstr "Propriété" msgid "Feature properties" msgstr "Propriétés" +#, fuzzy +#| msgid "Other settings" +msgid "Routing setting" +msgstr "Autres réglages" + +#, fuzzy +#| msgid "Other settings" +msgid "Routing settings" +msgstr "Autres réglages" + msgid "UI schema & properties" msgstr "Propriété et UI schema" @@ -104,22 +114,32 @@ msgstr "Géométrie annexes" msgid "Geographic Editor Config" msgstr "Config. Editeur Géographique" -msgid "" -"GEOCRUD: Can create / edit / delete views / groups and associated layers." +#, fuzzy +#| msgid "" +#| "GEOCRUD: Can create / edit / delete views / groups and associated layers." +msgid "CRUD: Can create / edit / delete views / groups and associated layers." msgstr "" "GEOCRUD: Peut créer / éditier / supprimer les vues / groupes et layers " "associés." -msgid "GEOCRUD: Can read feature detail." +#, fuzzy +#| msgid "GEOCRUD: Can read feature detail." +msgid "CRUD: Can read feature detail." msgstr "GEOCRUD: Peut lire les détails d'une feature" -msgid "GEOCRUD: Can create feature" +#, fuzzy +#| msgid "GEOCRUD: Can create feature" +msgid "CRUD: Can create feature" msgstr "GEOCRUD: Peut créer des features" -msgid "GEOCRUD: Can change feature" +#, fuzzy +#| msgid "GEOCRUD: Can change feature" +msgid "CRUD: Can change feature" msgstr "GEOCRUD: Peut modifier une feature" -msgid "GEOCRUD: Can delete feature" +#, fuzzy +#| msgid "GEOCRUD: Can delete feature" +msgid "CRUD: Can delete feature" msgstr "GEOCRUD: Peut supprimer une feature" msgid "You should define geometry with drawing or file." @@ -245,6 +265,60 @@ msgstr "" "la valeur '{self.value}' doît être de même type que la propriété ({self." "property.json_schema.get('type')})" +msgid "Mapbox" +msgstr "Mapbox" + +msgid "Geostore" +msgstr "Geostore" + +msgid "Label that will be shown on the list" +msgstr "Étiquette qui sera affichée sur la liste" + +msgid "Provider's name" +msgstr "Nom du fournisseur" + +msgid "Mabox transit" +msgstr "Mabox transit" + +msgid "Driving" +msgstr "Voiture" + +msgid "Walking" +msgstr "Marche" + +msgid "Cycling" +msgstr "Vélo" + +#, fuzzy +#| msgid "You should define geometry with drawing or file." +msgid "You should define layer with a routable layer" +msgstr "" +"You devez définir la géométrie en la déssinant ou en fournissant un fichier." + +msgid "You shouldn't define layer and mapbox_transit" +msgstr "Vous ne devez pas définir layer et mapbox_transit en même temps" + +msgid "You use the wrong provider" +msgstr "Vous utilisez le mauvais provider" + +#, fuzzy +#| msgid "You should define geometry with drawing or file." +msgid "You should define a mapbox_transit with this provider" +msgstr "" +"Vous devez définir la géométrie en la déssinant ou en fournissant un fichier." + +#, fuzzy +#| msgid "You should define geometry with drawing or file." +msgid "You should define a layer with this provider" +msgstr "" +"Vous devez définir la géométrie en la déssinant ou en fournissant un fichier." + +msgid "This transit is already used" +msgstr "Ce transit est déjà utilisé" + +msgid "This layer is already used" +msgstr "Cette couche est déjà utilisé" + msgid "VT styles and definitions" msgstr "Style et définition des tuiles vectorielles" From c94810f1c25476469c540ffdfea67583fc813585 Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Fri, 22 Jan 2021 15:21:59 +0100 Subject: [PATCH 28/28] Change changelog --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index fc7a9166..9a906ab0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,7 +4,7 @@ CHANGELOG 1.0.4.dev0 (XXXX-XX-XX) ---------------------------- -* +* Add routing settings for each crudview 1.0.3 (2020-12-10)