From 63e175d48a74abe45cdae1366c9f51741b02036f Mon Sep 17 00:00:00 2001 From: Casey Cesari Date: Wed, 25 Oct 2017 15:45:41 -0400 Subject: [PATCH] Hide user endpoints in Swagger API documentation The user namespace is added to the user URLs, which, because of our Swagger configuration, prevents the URLs from showing up in the documentation. This was originally added in #2227, but it broke compatibility with ITSI and was removed in #2377. The namespace is added here again along with a fix to the ITSI login view. When calling reverse on a URL which is included in a namespace, the namespace must also be added to the reverse parameter. See https://stackoverflow.com/a/38390178/217378. Refs #2401 --- src/mmw/apps/user/views.py | 2 +- src/mmw/mmw/urls.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mmw/apps/user/views.py b/src/mmw/apps/user/views.py index 786218904..3752144f0 100644 --- a/src/mmw/apps/user/views.py +++ b/src/mmw/apps/user/views.py @@ -107,7 +107,7 @@ def logout(request): def itsi_login(request): redirect_uri = '{0}?next={1}'.format( - request.build_absolute_uri(reverse(itsi_auth)), + request.build_absolute_uri(reverse('user:itsi_auth')), request.GET.get('next', '/') ) params = {'redirect_uri': redirect_uri} diff --git a/src/mmw/mmw/urls.py b/src/mmw/mmw/urls.py index 71dac1033..512efca31 100644 --- a/src/mmw/mmw/urls.py +++ b/src/mmw/mmw/urls.py @@ -37,5 +37,6 @@ namespace='mmw')), url(r'^api/', include(apps.geoprocessing_api.urls)), url(r'^micro/', include(apps.water_balance.urls)), - url(r'^user/', include(apps.user.urls)) + url(r'^user/', include(apps.user.urls, + namespace='user')) )