From f5a67531cc46bdb71fccfa422db93107bda973e7 Mon Sep 17 00:00:00 2001 From: LePetitTim Date: Wed, 1 Mar 2023 12:50:21 +0100 Subject: [PATCH 001/117] =?UTF-8?q?=F0=9F=91=B7=20Add=20publication=20regi?= =?UTF-8?q?stry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2daafa06e2..af7cf679a9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -399,17 +399,27 @@ jobs: with: username: ${{ secrets.DOCKER_LOGIN }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Publish Docker image (v2 and latest) run: | if [[ "${{ github.ref }}" == *"dev"* ]]; then export DOCKER_TAG=dev else + docker tag geotrek:latest ghcr.io/geotrek-admin:$DOCKER_TAG docker tag geotrek:latest geotrekce/admin:$(cat VERSION) docker push geotrekce/admin:$(cat VERSION) + docker push ghcr.io/geotrek-admin:$(cat VERSION) export DOCKER_TAG=latest fi docker tag geotrek:latest geotrekce/admin:$DOCKER_TAG + docker tag geotrek:latest ghcr.io/geotrek-admin:$DOCKER_TAG docker push geotrekce/admin:$DOCKER_TAG + docker push ghcr.io/geotrek-admin:$DOCKER_TAG - name: Install SSH key uses: shimataro/ssh-key-action@v2 with: From ea1409580977772253be16545f4bc5b6356c0d2f Mon Sep 17 00:00:00 2001 From: Jean-Etienne Castagnede Date: Wed, 6 Sep 2023 10:08:43 +0200 Subject: [PATCH 002/117] set permission to publish docker image to github --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index af7cf679a9..40e52f4a3f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,6 +39,9 @@ jobs: name: Python Unittests runs-on: ubuntu-latest container: makinacorpus/geodjango:${{ matrix.os }} + + permissions: + packages: write # required to publish docker image strategy: matrix: From 434d8a99fcdac8e10c6cf8e5d777127d88e84270 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 17 Oct 2024 11:47:26 +0000 Subject: [PATCH 003/117] Bump reportlab from 4.1.0 to 4.2.5 Bumps [reportlab](https://www.reportlab.com/) from 4.1.0 to 4.2.5. --- updated-dependencies: - dependency-name: reportlab dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 026a77dc5d..2372196d91 100644 --- a/requirements.txt +++ b/requirements.txt @@ -313,7 +313,7 @@ rcssmin==1.1.1 # via django-compressor redis==5.1.1 # via geotrek (setup.py) -reportlab==4.1.0 +reportlab==4.2.5 # via # easy-thumbnails # svglib From c6b149e5c136a3ce9f33a7e40d3028f60076e76a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 28 Oct 2024 04:22:31 +0000 Subject: [PATCH 004/117] Bump pytz from 2023.3.post1 to 2024.2 Bumps [pytz](https://github.com/stub42/pytz) from 2023.3.post1 to 2024.2. - [Release notes](https://github.com/stub42/pytz/releases) - [Commits](https://github.com/stub42/pytz/compare/release_2023.3.post1...release_2024.2) --- updated-dependencies: - dependency-name: pytz dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index eb3f1f939b..8cfdfdae82 100644 --- a/requirements.txt +++ b/requirements.txt @@ -301,7 +301,7 @@ python-dotenv==1.0.0 # via geotrek (setup.py) python-magic==0.4.27 # via paperclip -pytz==2023.3.post1 +pytz==2024.2 # via # datetime # django-modelcluster From edaccfa5af9f61471ee2e867265a4be93e0de658 Mon Sep 17 00:00:00 2001 From: Jean-Etienne Castagnede Date: Wed, 6 Nov 2024 10:26:54 +0000 Subject: [PATCH 005/117] fix deps --- docs/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index e4dc5fc7a4..5feca3c1bf 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -55,7 +55,7 @@ packaging==24.0 # sphinx pygments==2.18.0 # via sphinx -pytz==2023.3.post1 +pytz==2024.2 # via # -c docs/../requirements.txt # babel From 12d22cf5d2fa7d3a9246aeb8f387468e7ccb398e Mon Sep 17 00:00:00 2001 From: lpofredc Date: Wed, 13 Nov 2024 16:53:39 +0100 Subject: [PATCH 006/117] :bug: [Bug] Fix missing Dockerfile path on make build scripts (fix #4365) --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index a89baf4538..6c92554257 100644 --- a/Makefile +++ b/Makefile @@ -15,10 +15,10 @@ COLOR_DEBUG = \033[36m COLOR_RESET = \033[0m build: - docker build -t geotrek . --build-arg BASE_IMAGE_TAG=$(BASE_IMAGE_TAG) + docker build -t geotrek -f docker/Dockerfile . --build-arg BASE_IMAGE_TAG=$(BASE_IMAGE_TAG) -build-no-cache: - docker build -t geotrek --no-cache . +build_no_cache: + docker build -t geotrek -f docker/Dockerfile --no-cache . build_deb: docker pull $(DISTRO) From 49d9afc355788f791c1342839b513b5efc4e8934 Mon Sep 17 00:00:00 2001 From: lpofredc Date: Wed, 13 Nov 2024 17:00:50 +0100 Subject: [PATCH 007/117] :memo: [doc] Update changelog --- docs/changelog.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index e9af4bba3a..172326f082 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -5,6 +5,9 @@ CHANGELOG 2.110.0+dev (XXXX-XX-XX) ---------------------------- +**Bug fixes** + +- Fix missing Dockerfile path on make build scripts 2.110.0 (2024-11-13) From 5ffe2cf63b493e63dcae190c3cef6cb5f9dc7c57 Mon Sep 17 00:00:00 2001 From: Chatewgne Date: Wed, 13 Nov 2024 11:22:09 +0100 Subject: [PATCH 008/117] =?UTF-8?q?=F0=9F=93=9D=20[DOC]=20Update=20release?= =?UTF-8?q?=20and=20maintenance=20doc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/changelog.rst | 4 ++++ docs/contribute/contributing.rst | 10 +++++----- docs/install/maintenance.rst | 4 +--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 172326f082..b49866c94b 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -9,6 +9,10 @@ CHANGELOG - Fix missing Dockerfile path on make build scripts +**Documentation** + +- Update documentation for release and update obsolete example + 2.110.0 (2024-11-13) ---------------------------- diff --git a/docs/contribute/contributing.rst b/docs/contribute/contributing.rst index 47a37182bc..04a996d7b0 100644 --- a/docs/contribute/contributing.rst +++ b/docs/contribute/contributing.rst @@ -103,16 +103,16 @@ Release On master branch: -* Update files *VERSION*, *docs/conf.py* and *docs/changelog.rst* to remove ``+dev`` suffix and increment version (please use semver rules) +* Update files *VERSION* and *docs/changelog.rst* to remove ``+dev`` suffix and increment version (please use semver rules) * Run ``dch -r -D RELEASED``, update version in the same way and save -* Commit with message 'Release x.y.z' and push to ``master`` -* Create new release on Github, with tag X.Y.Z, click on "Generate release notes" +* Commit with message 'Release X.Y.Z' and push to ``master`` +* Create new release with name 'Geotrek-admin X.Y.Z' on Github, with tag X.Y.Z, click on "Generate release notes" * Wait for release to be published through CI -* Update files *VERSION*, *docs/conf.py* and *docs/changelog.rst* to add ``+dev`` suffix +* Update files *VERSION* and *docs/changelog.rst* to add ``+dev`` suffix * Run ``dch -v +dev --no-force-save-on-release`` and save * Commit with message 'Back to development' and push to ```master`` -* When creating a new release 'x.y.z' on github, Github actions will generate the .deb package file, and publish it on https://packages.geotrek.fr (see ``.github/workflows/test.yml`` file for details) +* When creating a new release 'X.Y.Z' on github, Github actions will generate the .deb package file, and publish it on https://packages.geotrek.fr (see ``.github/workflows/test.yml`` file for details) Other ways to contribute ------------------------- diff --git a/docs/install/maintenance.rst b/docs/install/maintenance.rst index 66c7a72fee..2b2322b465 100644 --- a/docs/install/maintenance.rst +++ b/docs/install/maintenance.rst @@ -34,11 +34,9 @@ Application restore If you restore Geotrek-admin on a new server, you will have to install PostgreSQL and PostGIS and create a database user first. Otherwise go directly to the database creation step. -Example for Ubuntu 18: - .. code-block:: bash - sudo apt install postgresql-10 postgresql-10-postgis-2.5 + sudo apt install postgresql-14 postgresql-14-postgis-3 sudo -u postgres psql -c "CREATE USER geotrek PASSWORD 'geotrek';" From f3d07162db11164bed99460c08451ec4cfff47b2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 04:10:12 +0000 Subject: [PATCH 009/117] Bump codecov/codecov-action from 4 to 5 Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e1af6712e6..462145d8eb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -184,7 +184,7 @@ jobs: name: coverage_${{ matrix.os }}_${{ matrix.tests-env }} path: . - - uses: codecov/codecov-action@v4 + - uses: codecov/codecov-action@v5 with: files: ./coverage.xml env_vars: OS,ENV From db46b9542a8e9be3bd327ec6bc27d6b5be04e129 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 04:38:26 +0000 Subject: [PATCH 010/117] Bump django-compressor from 4.4 to 4.5.1 Bumps [django-compressor](https://github.com/django-compressor/django-compressor) from 4.4 to 4.5.1. - [Changelog](https://github.com/django-compressor/django-compressor/blob/develop/docs/changelog.txt) - [Commits](https://github.com/django-compressor/django-compressor/compare/4.4...4.5.1) --- updated-dependencies: - dependency-name: django-compressor dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index f0a2038b56..c0877f4a7b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -131,7 +131,7 @@ django-clearcache==1.2.1 # via geotrek (setup.py) django-colorfield==0.11.0 # via geotrek (setup.py) -django-compressor==4.4 +django-compressor==4.5.1 # via mapentity django-crispy-forms==2.3 # via From f2d85cd7b7467d6cf1ccd45a489ee9a32b7b57ff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 04:38:38 +0000 Subject: [PATCH 011/117] Bump zope-interface from 6.4.post2 to 7.1.1 Bumps [zope-interface](https://github.com/zopefoundation/zope.interface) from 6.4.post2 to 7.1.1. - [Changelog](https://github.com/zopefoundation/zope.interface/blob/master/CHANGES.rst) - [Commits](https://github.com/zopefoundation/zope.interface/compare/6.4.post2...7.1.1) --- updated-dependencies: - dependency-name: zope-interface dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index f0a2038b56..43acdf69f2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -408,7 +408,7 @@ zodbpickle==4.0 # via zodb zope-deferredimport==5.0 # via persistent -zope-interface==6.4.post2 +zope-interface==7.1.1 # via # btrees # datetime From 3853263d138753add6b97113f9023d7be2dca0c5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:46:01 +0000 Subject: [PATCH 012/117] Bump cross-spawn from 7.0.3 to 7.0.5 in /cypress Bumps [cross-spawn](https://github.com/moxystudio/node-cross-spawn) from 7.0.3 to 7.0.5. - [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md) - [Commits](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.3...v7.0.5) --- updated-dependencies: - dependency-name: cross-spawn dependency-type: indirect ... Signed-off-by: dependabot[bot] --- cypress/package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cypress/package-lock.json b/cypress/package-lock.json index 66abd3b86c..c65edd1d41 100644 --- a/cypress/package-lock.json +++ b/cypress/package-lock.json @@ -475,9 +475,9 @@ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.5.tgz", + "integrity": "sha512-ZVJrKKYunU38/76t0RMOulHOnUcbU9GbpWKAOZ0mhjr7CX6FVrH+4FrAapSOekrgFQ3f/8gwMEuIft0aKq6Hug==", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -2117,9 +2117,9 @@ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.5.tgz", + "integrity": "sha512-ZVJrKKYunU38/76t0RMOulHOnUcbU9GbpWKAOZ0mhjr7CX6FVrH+4FrAapSOekrgFQ3f/8gwMEuIft0aKq6Hug==", "requires": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", From 249535625887169d0f6a7bfe9fa228d536aae4f8 Mon Sep 17 00:00:00 2001 From: Justine Fricou Date: Mon, 18 Nov 2024 11:10:39 +0100 Subject: [PATCH 013/117] =?UTF-8?q?=F0=9F=92=AB=20[IMPR]=20Remove=20overri?= =?UTF-8?q?ding=20of=20SchemaRandonneeParser's=20filetype=5Fname=20attribu?= =?UTF-8?q?te=20(#4022)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/changelog.rst | 4 ++++ geotrek/trekking/parsers.py | 1 - geotrek/trekking/tests/test_parsers.py | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index b49866c94b..2b0fc2c2a5 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -5,6 +5,10 @@ CHANGELOG 2.110.0+dev (XXXX-XX-XX) ---------------------------- +**Improvements** + +- Remove overriding of SchemaRandonneeParser's filetype_name attribute (#4022) + **Bug fixes** - Fix missing Dockerfile path on make build scripts diff --git a/geotrek/trekking/parsers.py b/geotrek/trekking/parsers.py index f7ce974908..e3eed00c19 100644 --- a/geotrek/trekking/parsers.py +++ b/geotrek/trekking/parsers.py @@ -1327,7 +1327,6 @@ class SchemaRandonneeParser(AttachmentParserMixin, Parser): eid = 'eid' separator = ',' srid = 4326 - filetype_name = 'image' fields = { 'eid': ('uuid', 'id_local'), diff --git a/geotrek/trekking/tests/test_parsers.py b/geotrek/trekking/tests/test_parsers.py index 051de15e89..a214f588c1 100644 --- a/geotrek/trekking/tests/test_parsers.py +++ b/geotrek/trekking/tests/test_parsers.py @@ -1801,7 +1801,7 @@ class SchemaRandonneeParserWithLicenseCreation(SchemaRandonneeParser): class SchemaRandonneeParserTests(TestCase): @classmethod def setUpTestData(cls): - FileType.objects.create(type="image") + FileType.objects.create(type="Photographie") Practice.objects.create(name="Pédestre") RecordSource.objects.create(name="Producer 1") License.objects.create(label="License 1") From 7877bfd46ba4a77e9f4959d977bd7ead47a00366 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Thu, 21 Nov 2024 13:54:59 +0100 Subject: [PATCH 014/117] bump appy to 1.0.18 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 43acdf69f2..d74ff7f0fa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ # amqp==5.2.0 # via kombu -appy==1.0.15 +appy==1.0.18 # via django-appypod asgiref==3.8.1 # via django From 353ca8b18943670ebda1a2b759a9e4686055c66c Mon Sep 17 00:00:00 2001 From: Justine Fricou Date: Thu, 14 Nov 2024 15:07:31 +0100 Subject: [PATCH 015/117] =?UTF-8?q?=F0=9F=90=9B=20[BUG]=20Fix=20schema=5Fr?= =?UTF-8?q?andonnee=20parser=20url=20update=20issues=20(#4022)=20-=20fix?= =?UTF-8?q?=20url=20being=20duplicated=20in=20description=20after=20new=20?= =?UTF-8?q?import=20if=20description=20is=20null=20or=20was=20not=20update?= =?UTF-8?q?d=20-=20description=20and=20url=20are=20now=20parsed=20in=20a?= =?UTF-8?q?=20filter=5Fdescription=20method=20rather=20than=20in=20the=20e?= =?UTF-8?q?nd=20method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/changelog.rst | 1 + geotrek/trekking/parsers.py | 29 ++++++------- .../description_and_url.geojson | 24 +++++++++++ .../description_no_url.geojson | 24 +++++++++++ .../find_url_in_description.geojson | 40 ++++++++++++++++++ ....geojson => no_description_no_url.geojson} | 3 +- .../update_url_after.geojson | 41 +++++++++++++++++++ .../update_url_before.geojson | 41 +++++++++++++++++++ .../url_no_description.geojson | 24 +++++++++++ geotrek/trekking/tests/test_parsers.py | 30 +++++++++++++- 10 files changed, 240 insertions(+), 17 deletions(-) create mode 100644 geotrek/trekking/tests/data/schema_randonnee_parser/description_and_url.geojson create mode 100644 geotrek/trekking/tests/data/schema_randonnee_parser/description_no_url.geojson create mode 100644 geotrek/trekking/tests/data/schema_randonnee_parser/find_url_in_description.geojson rename geotrek/trekking/tests/data/schema_randonnee_parser/{no_url.geojson => no_description_no_url.geojson} (91%) create mode 100644 geotrek/trekking/tests/data/schema_randonnee_parser/update_url_after.geojson create mode 100644 geotrek/trekking/tests/data/schema_randonnee_parser/update_url_before.geojson create mode 100644 geotrek/trekking/tests/data/schema_randonnee_parser/url_no_description.geojson diff --git a/docs/changelog.rst b/docs/changelog.rst index 2b0fc2c2a5..3b77ed494d 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -12,6 +12,7 @@ CHANGELOG **Bug fixes** - Fix missing Dockerfile path on make build scripts +- Fix SchemaRandonneeParser url update when description is null or was not updated (#4022) **Documentation** diff --git a/geotrek/trekking/parsers.py b/geotrek/trekking/parsers.py index e3eed00c19..92825d2101 100644 --- a/geotrek/trekking/parsers.py +++ b/geotrek/trekking/parsers.py @@ -1338,7 +1338,7 @@ class SchemaRandonneeParser(AttachmentParserMixin, Parser): 'arrival': 'arrivee', 'duration': 'duree', 'difficulty': 'difficulte', - 'description': 'instructions', + 'description': ('instructions', 'url'), 'ambiance': 'presentation', 'description_teaser': 'presentation_courte', 'advice': 'recommandations', @@ -1391,14 +1391,12 @@ class SchemaRandonneeParser(AttachmentParserMixin, Parser): 'attachments': 'medias', 'id_local': 'id_local', 'itineraire_parent': 'itineraire_parent', - 'url': 'url', } def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.related_treks_mapping = defaultdict(list) self.id_local_to_pk_mapping = {} - self.trek_urls = {} if self.url: response = self.request_or_retry(self.url) self.root = response.json() @@ -1453,6 +1451,19 @@ def filter_parking_location(self, src, val): except ValueError: self.add_warning(_("Bad value for parking geometry: should be a Point")) + def filter_description(self, src, val): + instructions, url = val + if not instructions and not url: + return None + description = "" + if instructions: + description += instructions + if instructions and url: + description += "\n\n" + if url: + description += f'{url}' + return description + def filter_attachments(self, src, val): """Handles images only""" if val is None: @@ -1548,10 +1559,6 @@ def get_or_create_license(self, license_label): self.add_warning(_("License '{val}' does not exist in Geotrek-Admin. Please add it").format(val=license_label)) return license - def save_url(self, src, val): - if val: - self.trek_urls[self.obj.pk] = val - def save_id_local(self, src, val): if val: self.id_local_to_pk_mapping[val] = self.obj.pk @@ -1562,14 +1569,8 @@ def save_itineraire_parent(self, src, val): def end(self): """ - After all treks have been created: - - concatenate the `url` field into the description - - add children + After all treks have been created, add parent/children relationships """ - for trek_pk, trek_url in self.trek_urls.items(): - trek = Trek.objects.get(pk=trek_pk) - trek.description = f'{trek.description}\n\n{trek_url}' - trek.save() for parent_id_local, child_pks in self.related_treks_mapping.items(): parent_pk = self.id_local_to_pk_mapping.get(parent_id_local) try: diff --git a/geotrek/trekking/tests/data/schema_randonnee_parser/description_and_url.geojson b/geotrek/trekking/tests/data/schema_randonnee_parser/description_and_url.geojson new file mode 100644 index 0000000000..b1c460ea3f --- /dev/null +++ b/geotrek/trekking/tests/data/schema_randonnee_parser/description_and_url.geojson @@ -0,0 +1,24 @@ +{ + "type": "FeatureCollection", + "name": "sql_statement", + "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, + "features": [ + { + "type": "Feature", + "properties": { + "id_local": "1", + "producteur": "Producer 1", + "nom_itineraire": "Trek 1", + "pratique": "pédestre", + "depart": "Departure 1", + "arrivee": "Arrival 1", + "instructions": "Instructions 1", + "url": "https://test.com" + }, + "geometry": { + "type": "LineString", + "coordinates": [ [ 6.449592517966364, 44.733424655086957 ], [ 6.449539623508488, 44.733394939411369 ] ] + } + } + ] +} \ No newline at end of file diff --git a/geotrek/trekking/tests/data/schema_randonnee_parser/description_no_url.geojson b/geotrek/trekking/tests/data/schema_randonnee_parser/description_no_url.geojson new file mode 100644 index 0000000000..f87f9b7f04 --- /dev/null +++ b/geotrek/trekking/tests/data/schema_randonnee_parser/description_no_url.geojson @@ -0,0 +1,24 @@ +{ + "type": "FeatureCollection", + "name": "sql_statement", + "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, + "features": [ + { + "type": "Feature", + "properties": { + "id_local": "1", + "producteur": "Producer 1", + "nom_itineraire": "Trek 1", + "pratique": "pédestre", + "depart": "Departure 1", + "arrivee": "Arrival 1", + "instructions": "Instructions 1", + "url": null + }, + "geometry": { + "type": "LineString", + "coordinates": [ [ 6.449592517966364, 44.733424655086957 ], [ 6.449539623508488, 44.733394939411369 ] ] + } + } + ] +} \ No newline at end of file diff --git a/geotrek/trekking/tests/data/schema_randonnee_parser/find_url_in_description.geojson b/geotrek/trekking/tests/data/schema_randonnee_parser/find_url_in_description.geojson new file mode 100644 index 0000000000..bc934850df --- /dev/null +++ b/geotrek/trekking/tests/data/schema_randonnee_parser/find_url_in_description.geojson @@ -0,0 +1,40 @@ +{ + "type": "FeatureCollection", + "name": "sql_statement", + "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, + "features": [ + { + "type": "Feature", + "properties": { + "id_local": "1", + "producteur": "Producer 1", + "url": "https://test.com", + "nom_itineraire": "Trek 1", + "pratique": "pédestre", + "depart": "Departure 1", + "arrivee": "Arrival 1", + "instructions": "Instructions 1" + }, + "geometry": { + "type": "LineString", + "coordinates": [ [ 6.449592517966364, 44.733424655086957 ], [ 6.449539623508488, 44.733394939411369 ] ] + } + }, + { + "type": "Feature", + "properties": { + "id_local": "2", + "producteur": "Producer 1", + "nom_itineraire": "Trek 1", + "pratique": "pédestre", + "depart": "Departure 1", + "arrivee": "Arrival 1", + "instructions": "Instructions 2" + }, + "geometry": { + "type": "LineString", + "coordinates": [ [ 6.449592517966364, 44.733424655086957 ], [ 6.449539623508488, 44.733394939411369 ] ] + } + } + ] +} \ No newline at end of file diff --git a/geotrek/trekking/tests/data/schema_randonnee_parser/no_url.geojson b/geotrek/trekking/tests/data/schema_randonnee_parser/no_description_no_url.geojson similarity index 91% rename from geotrek/trekking/tests/data/schema_randonnee_parser/no_url.geojson rename to geotrek/trekking/tests/data/schema_randonnee_parser/no_description_no_url.geojson index 8d2d4a69fc..250dde234f 100644 --- a/geotrek/trekking/tests/data/schema_randonnee_parser/no_url.geojson +++ b/geotrek/trekking/tests/data/schema_randonnee_parser/no_description_no_url.geojson @@ -12,7 +12,8 @@ "pratique": "pédestre", "depart": "Departure 1", "arrivee": "Arrival 1", - "instructions": "Instructions 1" + "instructions": null, + "url": null }, "geometry": { "type": "LineString", diff --git a/geotrek/trekking/tests/data/schema_randonnee_parser/update_url_after.geojson b/geotrek/trekking/tests/data/schema_randonnee_parser/update_url_after.geojson new file mode 100644 index 0000000000..11faa1780a --- /dev/null +++ b/geotrek/trekking/tests/data/schema_randonnee_parser/update_url_after.geojson @@ -0,0 +1,41 @@ +{ + "type": "FeatureCollection", + "name": "sql_statement", + "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, + "features": [ + { + "type": "Feature", + "properties": { + "id_local": "1", + "producteur": "Producer 1", + "url": "https://test.com", + "nom_itineraire": "Trek 1", + "pratique": "pédestre", + "depart": "Departure 1", + "arrivee": "Arrival 1", + "instructions": null + }, + "geometry": { + "type": "LineString", + "coordinates": [ [ 6.449592517966364, 44.733424655086957 ], [ 6.449539623508488, 44.733394939411369 ] ] + } + }, + { + "type": "Feature", + "properties": { + "id_local": "2", + "producteur": "Producer 1", + "url": "https://test2.com", + "nom_itineraire": "Trek 2", + "pratique": "pédestre", + "depart": "Departure 1", + "arrivee": "Arrival 1", + "instructions": "Instructions 2" + }, + "geometry": { + "type": "LineString", + "coordinates": [ [ 6.449592517966364, 44.733424655086957 ], [ 6.449539623508488, 44.733394939411369 ] ] + } + } + ] +} \ No newline at end of file diff --git a/geotrek/trekking/tests/data/schema_randonnee_parser/update_url_before.geojson b/geotrek/trekking/tests/data/schema_randonnee_parser/update_url_before.geojson new file mode 100644 index 0000000000..5b232be4ff --- /dev/null +++ b/geotrek/trekking/tests/data/schema_randonnee_parser/update_url_before.geojson @@ -0,0 +1,41 @@ +{ + "type": "FeatureCollection", + "name": "sql_statement", + "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, + "features": [ + { + "type": "Feature", + "properties": { + "id_local": "1", + "producteur": "Producer 1", + "url": "https://test.com", + "nom_itineraire": "Trek 1", + "pratique": "pédestre", + "depart": "Departure 1", + "arrivee": "Arrival 1", + "instructions": "Instructions 1" + }, + "geometry": { + "type": "LineString", + "coordinates": [ [ 6.449592517966364, 44.733424655086957 ], [ 6.449539623508488, 44.733394939411369 ] ] + } + }, + { + "type": "Feature", + "properties": { + "id_local": "2", + "producteur": "Producer 1", + "url": "https://test1.com", + "nom_itineraire": "Trek 2", + "pratique": "pédestre", + "depart": "Departure 1", + "arrivee": "Arrival 1", + "instructions": "Instructions 2" + }, + "geometry": { + "type": "LineString", + "coordinates": [ [ 6.449592517966364, 44.733424655086957 ], [ 6.449539623508488, 44.733394939411369 ] ] + } + } + ] +} \ No newline at end of file diff --git a/geotrek/trekking/tests/data/schema_randonnee_parser/url_no_description.geojson b/geotrek/trekking/tests/data/schema_randonnee_parser/url_no_description.geojson new file mode 100644 index 0000000000..b4d6978506 --- /dev/null +++ b/geotrek/trekking/tests/data/schema_randonnee_parser/url_no_description.geojson @@ -0,0 +1,24 @@ +{ + "type": "FeatureCollection", + "name": "sql_statement", + "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, + "features": [ + { + "type": "Feature", + "properties": { + "id_local": "1", + "producteur": "Producer 1", + "nom_itineraire": "Trek 1", + "pratique": "pédestre", + "depart": "Departure 1", + "arrivee": "Arrival 1", + "instructions": null, + "url": "https://test.com" + }, + "geometry": { + "type": "LineString", + "coordinates": [ [ 6.449592517966364, 44.733424655086957 ], [ 6.449539623508488, 44.733394939411369 ] ] + } + } + ] +} \ No newline at end of file diff --git a/geotrek/trekking/tests/test_parsers.py b/geotrek/trekking/tests/test_parsers.py index a214f588c1..be5e62b70b 100644 --- a/geotrek/trekking/tests/test_parsers.py +++ b/geotrek/trekking/tests/test_parsers.py @@ -2030,8 +2030,34 @@ def test_incorrect_parking_location(self): self.assertIsNone(trek.parking_location) self.assertIn("Bad value for parking geometry: should be a Point", output.getvalue()) - def test_no_url(self): - self.call_import_command_with_file('no_url.geojson') + def test_description_and_url(self): + self.call_import_command_with_file('description_and_url.geojson') + self.assertEqual(Trek.objects.count(), 1) + trek = Trek.objects.get() + self.assertEqual(trek.description, 'Instructions 1\n\nhttps://test.com') + + def test_description_no_url(self): + self.call_import_command_with_file('description_no_url.geojson') self.assertEqual(Trek.objects.count(), 1) trek = Trek.objects.get() self.assertEqual(trek.description, 'Instructions 1') + + def test_url_no_description(self): + self.call_import_command_with_file('url_no_description.geojson') + self.assertEqual(Trek.objects.count(), 1) + trek = Trek.objects.get() + self.assertEqual(trek.description, 'https://test.com') + + def test_no_description_no_url(self): + self.call_import_command_with_file('no_description_no_url.geojson') + self.assertEqual(Trek.objects.count(), 1) + trek = Trek.objects.get() + self.assertEqual(trek.description, '') + + def test_update_url(self): + self.call_import_command_with_file('update_url_before.geojson') + self.call_import_command_with_file('update_url_after.geojson') + trek1 = Trek.objects.get(eid="1") + self.assertEqual(trek1.description, "https://test.com") + trek2 = Trek.objects.get(eid="2") + self.assertEqual(trek2.description, "Instructions 2\n\nhttps://test2.com") From f5c0c7c3b1cd16e8cc95f1daf27276580e9e380c Mon Sep 17 00:00:00 2001 From: bruhnild Date: Fri, 22 Nov 2024 18:07:10 +0100 Subject: [PATCH 016/117] Add note about nginx configuration file --- docs/install/configuration.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/install/configuration.rst b/docs/install/configuration.rst index 47631332a6..a6b9394e63 100644 --- a/docs/install/configuration.rst +++ b/docs/install/configuration.rst @@ -71,11 +71,13 @@ After this, edit ``nginx.conf.in`` to add your certificate. If you generate it with letsencrypt : You can use certbot to add the certificate in your configuration. -But you will have to move the configuration automatically added into ``nginx.conf``, to the file ``nginx.conf.in`` -in ``/opt/geotrek-admin/var/conf/`` directory +But you will have to move the configuration automatically added into ``nginx.conf``, to the file ``nginx.conf.in`` in ``/opt/geotrek-admin/var/conf/`` directory. -You have to move the configuration to the file ``nginx.conf.in`` because ``nginx.conf`` is automatically -changed during command ``dpkg-reconfigure geotrek-admin``. +You have to move the configuration to the file ``nginx.conf.in`` because ``nginx.conf`` is automatically changed during command ``dpkg-reconfigure geotrek-admin``. + +.. note:: + + You need to replace the ``$`` from Certbot with ``${DOLLAR}`` everywhere in the ``nginx.conf.in`` file, then run the command ``sudo dpkg-reconfigure geotrek-admin`` to regenerate the file. Mandatory settings From cf42ec63eddcdbba545dd5ff46e7ac25450675aa Mon Sep 17 00:00:00 2001 From: bruhnild Date: Fri, 22 Nov 2024 18:10:51 +0100 Subject: [PATCH 017/117] Updatechangelog --- docs/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 2b0fc2c2a5..bfb3e24b19 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -16,6 +16,7 @@ CHANGELOG **Documentation** - Update documentation for release and update obsolete example +- Add note about certbot ssl configuration in nginx 2.110.0 (2024-11-13) From b856abe7b8f96e47069d17b483de45a493252d81 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 22 Nov 2024 22:28:18 +0000 Subject: [PATCH 018/117] Bump tornado from 6.4.1 to 6.4.2 in /docs Bumps [tornado](https://github.com/tornadoweb/tornado) from 6.4.1 to 6.4.2. - [Changelog](https://github.com/tornadoweb/tornado/blob/v6.4.2/docs/releases.rst) - [Commits](https://github.com/tornadoweb/tornado/compare/v6.4.1...v6.4.2) --- updated-dependencies: - dependency-name: tornado dependency-type: indirect ... Signed-off-by: dependabot[bot] --- docs/requirements.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 2630f0cf0c..eaf58453ff 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -60,16 +60,16 @@ snowballstemmer==2.2.0 # via sphinx sphinx==7.1.2 # via - # -r docs/requirements.in + # -r requirements.in # sphinx-autobuild # sphinx-immaterial # sphinx-intl sphinx-autobuild==2021.3.14 - # via -r docs/requirements.in + # via -r requirements.in sphinx-immaterial==0.11.14 - # via -r docs/requirements.in + # via -r requirements.in sphinx-intl==2.2.0 - # via -r docs/requirements.in + # via -r requirements.in sphinxcontrib-applehelp==1.0.4 # via sphinx sphinxcontrib-devhelp==1.0.2 @@ -82,7 +82,7 @@ sphinxcontrib-qthelp==1.0.3 # via sphinx sphinxcontrib-serializinghtml==1.1.5 # via sphinx -tornado==6.4.1 +tornado==6.4.2 # via livereload typing-extensions==4.12.2 # via From 2be460cf1fd9d688b9e5801b1cdb88843a768f2a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 04:39:15 +0000 Subject: [PATCH 019/117] Bump gunicorn from 22.0.0 to 23.0.0 Bumps [gunicorn](https://github.com/benoitc/gunicorn) from 22.0.0 to 23.0.0. - [Release notes](https://github.com/benoitc/gunicorn/releases) - [Commits](https://github.com/benoitc/gunicorn/compare/22.0.0...23.0.0) --- updated-dependencies: - dependency-name: gunicorn dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index d74ff7f0fa..3bcc03ec3b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -204,7 +204,7 @@ geojson==3.1.0 # tif2geojson gpxpy==1.6.2 # via mapentity -gunicorn==22.0.0 +gunicorn==23.0.0 # via geotrek (setup.py) html5lib==1.1 # via weasyprint From fef19d4a2931d02e5c89bd4be58f744db17371ff Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Mon, 25 Nov 2024 11:13:03 +0100 Subject: [PATCH 020/117] fix deps --- requirements.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index c0877f4a7b..74cc763d99 100644 --- a/requirements.txt +++ b/requirements.txt @@ -105,6 +105,7 @@ django==4.2.16 # django-appypod # django-celery-results # django-clearcache + # django-compressor # django-crispy-forms # django-embed-video # django-filter @@ -309,7 +310,7 @@ pytz==2023.3.post1 # drf-yasg pyvips==2.2.3 # via large-image-source-vips -rcssmin==1.1.1 +rcssmin==1.1.2 # via django-compressor redis==5.1.1 # via geotrek (setup.py) @@ -323,7 +324,7 @@ requests==2.32.3 # django-embed-video # landez # mapentity -rjsmin==1.2.1 +rjsmin==1.2.2 # via django-compressor ruamel-yaml==0.18.6 # via drf-yasg From 7128758c97a3a23a9db412dbe31a1d15cdd68149 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 26 Nov 2024 10:53:03 +0100 Subject: [PATCH 021/117] fix docs --- docs/requirements.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index eaf58453ff..655fc0513b 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -60,16 +60,16 @@ snowballstemmer==2.2.0 # via sphinx sphinx==7.1.2 # via - # -r requirements.in + # -r docs/requirements.in # sphinx-autobuild # sphinx-immaterial # sphinx-intl sphinx-autobuild==2021.3.14 - # via -r requirements.in + # via -r docs/requirements.in sphinx-immaterial==0.11.14 - # via -r requirements.in + # via -r docs/requirements.in sphinx-intl==2.2.0 - # via -r requirements.in + # via -r docs/requirements.in sphinxcontrib-applehelp==1.0.4 # via sphinx sphinxcontrib-devhelp==1.0.2 From da30c8cb66e6ca10c458cb6ef3ceaaa5d281cee5 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 26 Nov 2024 11:24:05 +0100 Subject: [PATCH 022/117] disable bionic tests --- .github/workflows/test.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 462145d8eb..19b3f61cb9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,7 +45,7 @@ jobs: strategy: matrix: - os: ['bionic-3.8', 'focal-3.8', 'jammy-3.10'] + os: ['focal-3.8', 'jammy-3.10'] tests-env: ['tests', 'tests_nds'] env: @@ -72,7 +72,7 @@ jobs: - 6379:6379 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/cache@v3 with: path: | @@ -114,13 +114,7 @@ jobs: libvips apt-get install -y --no-install-recommends postgis - - name: Install python venv for bionic - if: ${{ matrix.os == 'bionic-3.8'}} - run: | - python3.8 -m venv ./venv - - name: Install python venv - if: ${{ matrix.os != 'bionic-3.8'}} run: | python3 -m venv ./venv @@ -158,7 +152,6 @@ jobs: ./venv/bin/coverage xml -o coverage.xml - name: Save coverage - if: ${{ matrix.os != 'bionic-3.8'}} uses: actions/upload-artifact@v4 with: name: coverage_${{ matrix.os }}_${{ matrix.tests-env }} From 67daf36148e71a282ce9024623aff50dd4f69908 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Nov 2024 10:40:19 +0000 Subject: [PATCH 023/117] Bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/dependencies.yml | 2 +- .github/workflows/doc.yml | 2 +- .github/workflows/lint.yml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index 3fbe11e265..f7dfe99190 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -22,7 +22,7 @@ jobs: python-version: ['3.8'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python uses: ./.github/actions/python-cache-requirements diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 72ec66ce47..fd520b4ad0 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -21,7 +21,7 @@ jobs: name: Documentation runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ./.github/actions/python-cache-requirements with: requirements: docs/requirements.txt diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 758254c7f1..327c4f9311 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,7 +16,7 @@ jobs: name: Checking SRID in migrations files runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: | test $(ls geotrek/*/migrations/*.py | xargs grep -l srid | xargs grep -L SRID | wc -l) -eq 0 @@ -24,7 +24,7 @@ jobs: name: Checking Flake8 rules runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ./.github/actions/python-cache-requirements with: requirements: dev-requirements.txt From a6db591fe62047f79da8f68feb79b8bb1aa75644 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 26 Nov 2024 11:16:18 +0100 Subject: [PATCH 024/117] improve docker image definition and building --- .github/workflows/test.yml | 34 ++++++++++++++++++++++------------ docker/Dockerfile | 11 +++++++++++ 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 19b3f61cb9..149f94d93f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,6 +10,7 @@ on: push: branches: - master + - improve_docker_image paths-ignore: - 'docs/**' release: @@ -419,7 +420,7 @@ jobs: name: Publish (on release only) runs-on: ubuntu-latest needs: [ test, e2e_docker_image, build_deb, e2e_deb_20_04 ] - if: ${{ github.event_name == 'release' && github.event.action == 'created' }} + if: ${{ github.event_name != 'pull_request' }} steps: - uses: actions/checkout@v4 - name: Download 18.04 debian artifact @@ -443,17 +444,24 @@ jobs: username: ${{ secrets.DOCKER_LOGIN }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Publish Docker image (v2 and latest) - run: | - if [[ "${{ github.ref }}" == *"dev"* ]]; then - export DOCKER_TAG=dev - else - docker tag geotrek:latest geotrekce/admin:$(cat VERSION) - docker push geotrekce/admin:$(cat VERSION) - export DOCKER_TAG=latest - fi - docker tag geotrek:latest geotrekce/admin:$DOCKER_TAG - docker push geotrekce/admin:$DOCKER_TAG + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: geotrekce/admin + + - name: Build and push image + uses: docker/build-push-action@v6 + with: + push: true + provenance: mode=max + sbom: true + builder: ${{ steps.buildx.outputs.name }} + tags: ${{ steps.meta.outputs.tags }} - name: Install SSH key uses: shimataro/ssh-key-action@v2 @@ -462,6 +470,7 @@ jobs: known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }} - name: Publish debian packages + if: ${{ github.event_name == 'release' && github.event.action == 'created' }} run: | if [[ "${{ github.ref }}" == *"dev"* ]]; then export DEB_COMPONENT=dev @@ -484,6 +493,7 @@ jobs: name: jammy - name: Attach debian packages as release binaries + if: ${{ github.event_name == 'release' && github.event.action == 'created' }} uses: skx/github-action-publish-binaries@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/docker/Dockerfile b/docker/Dockerfile index 8620518639..a54e197eed 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -2,6 +2,17 @@ ARG BASE_IMAGE=jammy FROM ubuntu:${BASE_IMAGE} AS base +# add labels +LABEL org.opencontainers.image.authors="Makina Corpus" +LABEL org.opencontainers.image.source="https://github.com/GeotrekCE/Geotrek-admin/" +LABEL org.opencontainers.image.documentation="https://geotrek.readthedocs.io/" +LABEL org.opencontainers.image.vendor="Makina Corpus" +LABEL org.opencontainers.image.licenses="BSD-2-Clause" +LABEL org.opencontainers.image.url="https://geotrek.fr" +LABEL org.opencontainers.image.title="Geotrek-admin" +LABEL org.opencontainers.image.description="Manage and promote your trails and tourist content and activities." + + ENV PYTHONBUFFERED=1 ENV DEBIAN_FRONTEND=noninteractive ENV ENV=prod From f5028c3db81b4fec10f0d797928a541fb462b11f Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 26 Nov 2024 11:17:16 +0100 Subject: [PATCH 025/117] improve docker image definition and building --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 149f94d93f..8751415b4a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ on: push: branches: - master - - improve_docker_image + - improve_docker_image_2 paths-ignore: - 'docs/**' release: From d345d806138296450389df13282d0dfe99db675e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Nov 2024 10:54:40 +0000 Subject: [PATCH 026/117] Bump actions/cache from 3 to 4 Bumps [actions/cache](https://github.com/actions/cache) from 3 to 4. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 19b3f61cb9..8daed5de4d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -73,7 +73,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: | ./venv From 7235e2556faaa41586b8c5c3210f448430b020f0 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 26 Nov 2024 11:58:04 +0100 Subject: [PATCH 027/117] fix docker build --- .github/workflows/test.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8751415b4a..5a5a7b1cc6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -425,11 +425,13 @@ jobs: - uses: actions/checkout@v4 - name: Download 18.04 debian artifact uses: actions/download-artifact@v4 + if: ${{ github.event_name == 'release' && github.event.action == 'created' }} with: name: bionic - name: Download 20.04 debian artifact uses: actions/download-artifact@v4 + if: ${{ github.event_name == 'release' && github.event.action == 'created' }} with: name: focal @@ -462,9 +464,12 @@ jobs: sbom: true builder: ${{ steps.buildx.outputs.name }} tags: ${{ steps.meta.outputs.tags }} + load: true + file: ./docker/Dockerfile - name: Install SSH key uses: shimataro/ssh-key-action@v2 + if: ${{ github.event_name == 'release' && github.event.action == 'created' }} with: key: ${{ secrets.SSH_PRIVATE_KEY }} known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }} @@ -488,6 +493,7 @@ jobs: fi - name: Download 22.04 debian artifact + if: ${{ github.event_name == 'release' && github.event.action == 'created' }} uses: actions/download-artifact@v4 with: name: jammy From 9d1531602bbdf4c675b3b4e0afb3ba3c75615089 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 26 Nov 2024 12:13:49 +0100 Subject: [PATCH 028/117] fix docker build --- .github/workflows/test.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5a5a7b1cc6..8c6e8d49fa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -446,10 +446,6 @@ jobs: username: ${{ secrets.DOCKER_LOGIN }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v3 - - name: Extract metadata id: meta uses: docker/metadata-action@v5 @@ -462,9 +458,7 @@ jobs: push: true provenance: mode=max sbom: true - builder: ${{ steps.buildx.outputs.name }} tags: ${{ steps.meta.outputs.tags }} - load: true file: ./docker/Dockerfile - name: Install SSH key From ea5ed43cfadecb40021cc0112ba5be55b1845423 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Nov 2024 11:20:34 +0000 Subject: [PATCH 029/117] Bump django-appconf from 1.0.5 to 1.0.6 Bumps [django-appconf](https://github.com/django-compressor/django-appconf) from 1.0.5 to 1.0.6. - [Release notes](https://github.com/django-compressor/django-appconf/releases) - [Changelog](https://github.com/django-compressor/django-appconf/blob/develop/docs/changelog.rst) - [Commits](https://github.com/django-compressor/django-appconf/compare/v1.0.5...v1.0.6) --- updated-dependencies: - dependency-name: django-appconf dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index cfda301c3f..d39f2700b1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -122,7 +122,7 @@ django==4.2.16 # geotrek (setup.py) # mapentity # paperclip -django-appconf==1.0.5 +django-appconf==1.0.6 # via django-compressor django-appypod==2.0.7 # via mapentity From 95fcea5da3f5b93f74627e8b526b1a3c023d2b3d Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 26 Nov 2024 12:39:00 +0100 Subject: [PATCH 030/117] fix docker build --- .github/workflows/test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8c6e8d49fa..cb5390b38b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -446,6 +446,10 @@ jobs: username: ${{ secrets.DOCKER_LOGIN }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + - name: Extract metadata id: meta uses: docker/metadata-action@v5 @@ -458,6 +462,7 @@ jobs: push: true provenance: mode=max sbom: true + builder: ${{ steps.buildx.outputs.name }} tags: ${{ steps.meta.outputs.tags }} file: ./docker/Dockerfile From 4174921302ad94ec100c8d9d94b39e7d80980e43 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 26 Nov 2024 13:13:59 +0100 Subject: [PATCH 031/117] fix docker build --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cb5390b38b..4345ba7759 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,6 @@ on: push: branches: - master - - improve_docker_image_2 paths-ignore: - 'docs/**' release: From fc01191fec15c94dd63276c9b76b8e0e73c2eff0 Mon Sep 17 00:00:00 2001 From: Jean-Etienne Castagnede Date: Tue, 26 Nov 2024 14:00:26 +0100 Subject: [PATCH 032/117] Apply suggestions from code review fix image list --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index de4bc1ad4e..ea956433ee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -456,9 +456,9 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: - - geotrekce/admin - - ghcr.io/geotrek-admin + images: | + geotrekce/admin + ghcr.io/geotrek-admin - name: Build and push image uses: docker/build-push-action@v6 From 3b8e4302996256bb37b7cdf2c650f056c306f6ed Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 26 Nov 2024 14:15:29 +0100 Subject: [PATCH 033/117] add docker tag --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ea956433ee..a0505e84aa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,6 +10,7 @@ on: push: branches: - master + - ci_add_registry_publish paths-ignore: - 'docs/**' release: From 03be1bb13d812313584ba5b6e522d01215e1eb6d Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 26 Nov 2024 14:45:32 +0100 Subject: [PATCH 034/117] add docker tag --- .github/workflows/test.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a0505e84aa..7b09eccc4a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -449,6 +449,13 @@ jobs: username: ${{ secrets.DOCKER_LOGIN }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@v3 From f5ad25592783904219a7db96a0b6ce73791b0344 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 26 Nov 2024 15:06:40 +0100 Subject: [PATCH 035/117] add docker tag --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7b09eccc4a..8f7db7b13a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -466,7 +466,7 @@ jobs: with: images: | geotrekce/admin - ghcr.io/geotrek-admin + ghcr.io/geotrekce/geotrek-admin - name: Build and push image uses: docker/build-push-action@v6 From fe02ae768a38da400333942602ae2268cba46251 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 26 Nov 2024 15:25:48 +0100 Subject: [PATCH 036/117] add docker tag --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8f7db7b13a..507089e266 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ on: push: branches: - master - - ci_add_registry_publish + paths-ignore: - 'docs/**' release: From 2cb41ea5682abfd7123d699924a2fb4e3705a750 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 26 Nov 2024 15:27:45 +0100 Subject: [PATCH 037/117] add entry log --- docs/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 35f3e095f4..c85cf11d15 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -8,6 +8,7 @@ CHANGELOG **Improvements** - Remove overriding of SchemaRandonneeParser's filetype_name attribute (#4022) +- Docker image is now mirrored on github registry **Bug fixes** From 8d3a31e612c510df48b8fa9497d888b1c69d1445 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Tue, 12 Jul 2022 14:46:57 +0200 Subject: [PATCH 038/117] improve sync_rando view --- geotrek/common/templates/common/sync_rando.html | 0 geotrek/common/urls.py | 4 +++- geotrek/common/views.py | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 geotrek/common/templates/common/sync_rando.html diff --git a/geotrek/common/templates/common/sync_rando.html b/geotrek/common/templates/common/sync_rando.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/geotrek/common/urls.py b/geotrek/common/urls.py index 172ad6fb7f..ebdbfcae74 100644 --- a/geotrek/common/urls.py +++ b/geotrek/common/urls.py @@ -7,7 +7,6 @@ from .models import HDViewPoint from . import views - class LangConverter(converters.StringConverter): regex = "[a-z]{2}(-[a-z]{2,4})?" # noqa @@ -63,6 +62,9 @@ class LangConverter(converters.StringConverter): class PublishableEntityOptions(MapEntityOptions): + document_public_view = views.DocumentPublic + document_public_booklet_view = views.DocumentBookletPublic + markup_public_view =views.MarkupPublic document_public_view = views.DocumentPublic document_public_booklet_view = views.DocumentBookletPublic markup_public_view = views.MarkupPublic diff --git a/geotrek/common/views.py b/geotrek/common/views.py index f6b4852bce..e9cd7b71fa 100644 --- a/geotrek/common/views.py +++ b/geotrek/common/views.py @@ -31,6 +31,10 @@ from django.views.defaults import page_not_found from django.views.decorators.http import require_http_methods, require_POST from django.views.generic import TemplateView, UpdateView, View +from django.views.generic import RedirectView, TemplateView, UpdateView, View +from django.views.decorators.http import require_POST, require_http_methods +from django.views.generic import RedirectView, View, FormView +from django.views.generic import TemplateView from django_celery_results.models import TaskResult from django_large_image.rest import LargeImageFileDetailMixin from geotrek.common.filters import HDViewPointFilterSet From d229609f6876e80d542d1efd2196bdeec67e8306 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Fri, 30 Sep 2022 11:23:44 +0200 Subject: [PATCH 039/117] pep8 --- geotrek/common/urls.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/geotrek/common/urls.py b/geotrek/common/urls.py index ebdbfcae74..172ad6fb7f 100644 --- a/geotrek/common/urls.py +++ b/geotrek/common/urls.py @@ -7,6 +7,7 @@ from .models import HDViewPoint from . import views + class LangConverter(converters.StringConverter): regex = "[a-z]{2}(-[a-z]{2,4})?" # noqa @@ -62,9 +63,6 @@ class LangConverter(converters.StringConverter): class PublishableEntityOptions(MapEntityOptions): - document_public_view = views.DocumentPublic - document_public_booklet_view = views.DocumentBookletPublic - markup_public_view =views.MarkupPublic document_public_view = views.DocumentPublic document_public_booklet_view = views.DocumentBookletPublic markup_public_view = views.MarkupPublic From d4166ca84fa6a93256f9216d085a28ea7097bc38 Mon Sep 17 00:00:00 2001 From: J-E Castagnede Date: Thu, 6 Oct 2022 10:41:23 +0200 Subject: [PATCH 040/117] import sync and import views --- docs/changelog.rst | 3 +- geotrek/api/templates/mobile/sync_mobile.html | 72 ++++++++------- .../static/common/css/sync.css} | 0 .../templates/common/import_dataset.html | 90 +++++++++---------- 4 files changed, 88 insertions(+), 77 deletions(-) rename geotrek/{trekking/static/trekking/css/sync_trek.css => common/static/common/css/sync.css} (100%) diff --git a/docs/changelog.rst b/docs/changelog.rst index c85cf11d15..3b2062ea24 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -936,6 +936,7 @@ In preparation for HD Views developments (PR #3298) - Show direction on lines with setting ``DIRECTION_ON_LINES_ENABLED`` in signage detail - Add mobile nginx configuration directly on Geotrek-admin +- Improve sync rando, sync mobile and import views. **Bug fixes** @@ -951,7 +952,7 @@ In preparation for HD Views developments (PR #3298) !!!! Clear cache after update. You can do this by going to admin panel, "clearcache" section, then delete default / fat and api_v2 !!!! -**Improvements** +**Improvments** - Cache API v2 Detail endpoints and themes list endpoint - Sensitive areas are now computed with buffered geometries with settings SENSITIVE_AREA_INTERSECTION_MARGIN. Use ST_INTERSECTS on it is faster. diff --git a/geotrek/api/templates/mobile/sync_mobile.html b/geotrek/api/templates/mobile/sync_mobile.html index f689781660..c0f6cefb9b 100644 --- a/geotrek/api/templates/mobile/sync_mobile.html +++ b/geotrek/api/templates/mobile/sync_mobile.html @@ -32,29 +32,29 @@ has_progress = true; disable_sync_button(false); - $('#progress-value').show(); - $("#progress-value").removeClass('bar-danger'); - $("#progress-value").parent().addClass("active"); + $("#progress-bar").removeClass('bg-danger'); + $("#progress-bar").parent().addClass("active"); if (this.result.current) { - $("#progress-value").css("width", this.result.current+'%'); + $("#progress-bar").css("width", this.result.current + '%'); - if (this.result.current == 100){ - $("#progress-value").parent().removeClass("active"); - $("#progress-value").addClass('bar-success'); - } + if (this.result.current == 100) { + $("#progress-bar").parent().removeClass("active"); + $("#progress-bar").addClass('bg-success'); + } } if (this.result.infos) { - $("#progress-text").text(this.result.infos); - } + $("#progress-bar").text(this.result.infos); + } } else { if (this.status == 'FAILURE'){ // case of exception in task - $("#progress-text").text("{% trans 'An error occured' %}"); - $('#exception-message').text(this.result.exc_type + ' : ' + this.result.exc_message) - $("#progress-value").addClass('bar-danger'); - $("#progress-value").parent().removeClass("active"); + $("#progress-bar").text("{% trans 'An error occured' %}"); + $('#exception-message').text(this.result.exc_type + ' : ' + this.result.exc_message) + $('#exception-message').show(); + $("#progress-bar").addClass('bg-danger'); + $("#progress-value").parent().removeClass("active"); } } }); @@ -70,11 +70,12 @@ get_sync_infos(); $('#btn-confirm')[0].addEventListener('click', function(evt) { - $("#progress-value").css("width", '0%'); - $("#progress-text").text(''); - $("#progress-value").parent().addClass("active"); - $("#progress-value").removeClass('bar-success'); - $("#progress-value").removeClass('bar-danger'); + $('#exception-message').hide(); + $("#progress-bar").css("width", '0%'); + $("#progress-bar").text(''); + $("#progress-bar").parent().addClass("active"); + $("#progress-bar").removeClass('bg-success'); + $("#progress-bar").removeClass('bg-danger'); $.post( $('#form-sync').attr('action'), @@ -87,10 +88,10 @@ window.setInterval(function(){ get_sync_infos(); - }, 500); + }, 1000); }); - + {% endblock extrahead %} {% block toolbar %} @@ -98,22 +99,31 @@ {% block mainpanel %} -
-

{% trans "Mobile sync" %}

-
-
- -
- {% block mainform %} - {% crispy form form.helper %} - {% endblock mainform %} +
+
+
+

{% trans "Mobile sync" %}

+
+ +
+
+
+
+ +
+ +