diff options
author | Ătienne Loks <etienne.loks@iggdrasil.net> | 2023-11-28 14:50:39 +0100 |
---|---|---|
committer | Ătienne Loks <etienne.loks@iggdrasil.net> | 2023-11-28 14:51:12 +0100 |
commit | a5d3afd375e0232f51a9525f54a455b8b2529090 (patch) | |
tree | 2b523cba2482b47cdf9a26db9be44e7f32fad260 | |
parent | 959e8ac458a0379636df15ff851e30f0096f8bff (diff) | |
download | Ishtar-a5d3afd375e0232f51a9525f54a455b8b2529090.tar.bz2 Ishtar-a5d3afd375e0232f51a9525f54a455b8b2529090.zip |
đ Admin Profile type - fix "default center" field (refs #5675)
-rw-r--r-- | changelog/en/changelog_2022-06-15.md | 4 | ||||
-rw-r--r-- | changelog/fr/changelog_2023-01-25.md | 4 | ||||
-rw-r--r-- | ishtar_common/admin.py | 17 |
3 files changed, 23 insertions, 2 deletions
diff --git a/changelog/en/changelog_2022-06-15.md b/changelog/en/changelog_2022-06-15.md index 737967018..df6e0630b 100644 --- a/changelog/en/changelog_2022-06-15.md +++ b/changelog/en/changelog_2022-06-15.md @@ -3,7 +3,9 @@ v4.0.67 - 2023-11-28 ### Bug fixes ### - GIS form - remove "timestamp" fields (#5673) -- Instance Profile - fix migration: provide default for complete id and cached label (#5674) +- Instance Profile: + - fix migration: provide default for complete id and cached label (#5674) + - fix "default center" field (#5675) v4.0.66 - 2023-11-22 -------------------- diff --git a/changelog/fr/changelog_2023-01-25.md b/changelog/fr/changelog_2023-01-25.md index 16767cca8..4b822e556 100644 --- a/changelog/fr/changelog_2023-01-25.md +++ b/changelog/fr/changelog_2023-01-25.md @@ -3,7 +3,9 @@ v4.0.67 - 2023-11-28 ### Corrections de dysfonctionnements ### - Formulaire SIG - suppression des champs "horodatage" (#5673) -- Profile d'instance - correction de migration de base de données : valeur par défaut pour l'identifiant complet et le libellé mise en cache (#5674) +- Profile d'instance : + - correction de migration de base de données : valeur par défaut pour l'identifiant complet et le libellé mise en cache (#5674) + - correction du champ "centre par défaut" (#5675) v4.0.66 - 2023-11-22 -------------------- diff --git a/ishtar_common/admin.py b/ishtar_common/admin.py index 58ef286e1..ae4a3227b 100644 --- a/ishtar_common/admin.py +++ b/ishtar_common/admin.py @@ -624,6 +624,23 @@ class IshtarSiteProfileAdmin(admin.ModelAdmin): }), ) + class Media: + js = ( + "ol/ol.js", + "ol-layerswitcher/ol-layerswitcher.js", + "admin/js/jquery.init.js", + "js/ishtar-map.js", + ) + + def save_model(self, request, obj, form, change): + # reverse... geo + form.cleaned_data["default_center"] = form.cleaned_data["default_center"].transform(4326) + point = form.cleaned_data["default_center"] + if point: + form.cleaned_data["default_center"].x = point.y + form.cleaned_data["default_center"].y = point.x + super().save_model(request, obj, form, change) + admin_site.register(models.IshtarSiteProfile, IshtarSiteProfileAdmin) |