From c1698545bd6e5045f791e5753e4eed8263bdef2f Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Tue, 26 Sep 2023 10:34:50 +0200 Subject: [PATCH] Make sure SHORT_SITE_URL is defined to expose Map.short_url --- umap/views.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/umap/views.py b/umap/views.py index cd907f7b..0d341585 100644 --- a/umap/views.py +++ b/umap/views.py @@ -585,11 +585,11 @@ class MapView(MapDetailMixin, PermissionsMixin, DetailView): return self.object.pk def get_short_url(self): - shortUrl = None - if hasattr(settings, "SHORT_SITE_URL"): + short_url = None + if getattr(settings, "SHORT_SITE_URL", None): short_path = reverse_lazy("map_short_url", kwargs={"pk": self.object.pk}) - shortUrl = "%s%s" % (settings.SHORT_SITE_URL, short_path) - return shortUrl + short_url = "%s%s" % (settings.SHORT_SITE_URL, short_path) + return short_url def get_geojson(self): map_settings = self.object.settings