Remove duplicate short_url declarations

This commit is contained in:
Yohan Boniface 2018-05-19 12:01:53 +02:00
parent 53c738abaf
commit 1ef5e13f48
3 changed files with 3 additions and 7 deletions

View file

@ -164,7 +164,6 @@ UMAP_DEMO_SITE = False
UMAP_EXCLUDE_DEFAULT_MAPS = False UMAP_EXCLUDE_DEFAULT_MAPS = False
UMAP_MAPS_PER_PAGE = 5 UMAP_MAPS_PER_PAGE = 5
UMAP_MAPS_PER_PAGE_OWNER = 10 UMAP_MAPS_PER_PAGE_OWNER = 10
MAP_SHORT_URL_NAME = "umap_short_url"
UMAP_USE_UNACCENT = False UMAP_USE_UNACCENT = False
UMAP_FEEDBACK_LINK = "https://wiki.openstreetmap.org/wiki/UMap#Feedback_and_help" # noqa UMAP_FEEDBACK_LINK = "https://wiki.openstreetmap.org/wiki/UMap#Feedback_and_help" # noqa
USER_MAPS_URL = 'user_maps' USER_MAPS_URL = 'user_maps'

View file

@ -21,7 +21,8 @@ admin.autodiscover()
urlpatterns = [ urlpatterns = [
url(r'^admin/', admin.site.urls), url(r'^admin/', admin.site.urls),
url('', include('social_django.urls', namespace='social')), url('', include('social_django.urls', namespace='social')),
url(r'^m/(?P<pk>\d+)/$', views.MapShortUrl.as_view(), name='umap_short_url'), url(r'^m/(?P<pk>\d+)/$', views.MapShortUrl.as_view(),
name='map_short_url'),
url(r'^ajax-proxy/$', cache_page(180)(views.ajax_proxy), url(r'^ajax-proxy/$', cache_page(180)(views.ajax_proxy),
name='ajax-proxy'), name='ajax-proxy'),
url(r'^change-password/', auth_views.password_change, url(r'^change-password/', auth_views.password_change,
@ -43,8 +44,6 @@ i18n_urls = [
views.MapOldUrl.as_view(), name='map_old_url'), views.MapOldUrl.as_view(), name='map_old_url'),
url(r'^map/anonymous-edit/(?P<signature>.+)$', url(r'^map/anonymous-edit/(?P<signature>.+)$',
views.MapAnonymousEditUrl.as_view(), name='map_anonymous_edit_url'), views.MapAnonymousEditUrl.as_view(), name='map_anonymous_edit_url'),
url(r'^m/(?P<pk>\d+)/$', views.MapShortUrl.as_view(),
name='map_short_url'),
url(r'^pictogram/json/$', views.PictogramJSONList.as_view(), url(r'^pictogram/json/$', views.PictogramJSONList.as_view(),
name='pictogram_list_json'), name='pictogram_list_json'),
] ]

View file

@ -439,9 +439,7 @@ class MapView(MapDetailMixin, DetailView):
def get_short_url(self): def get_short_url(self):
shortUrl = None shortUrl = None
if hasattr(settings, 'SHORT_SITE_URL'): if hasattr(settings, 'SHORT_SITE_URL'):
short_url_name = getattr(settings, 'MAP_SHORT_URL_NAME', short_path = reverse_lazy('map_short_url',
'map_short_url')
short_path = reverse_lazy(short_url_name,
kwargs={'pk': self.object.pk}) kwargs={'pk': self.object.pk})
shortUrl = "%s%s" % (settings.SHORT_SITE_URL, short_path) shortUrl = "%s%s" % (settings.SHORT_SITE_URL, short_path)
return shortUrl return shortUrl