aboutsummaryrefslogtreecommitdiff
path: root/middleware
diff options
context:
space:
mode:
Diffstat (limited to 'middleware')
-rw-r--r--middleware/remove_slash.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/middleware/remove_slash.py b/middleware/remove_slash.py
index 15be769..0fde6c0 100644
--- a/middleware/remove_slash.py
+++ b/middleware/remove_slash.py
@@ -5,6 +5,10 @@ class RemoveSlashMiddleware:
self.get_response = get_response
def __call__(self, request):
- if request.path != '/' and request.path.endswith('/'):
+ if '/admin' in request.path and not request.path.endswith('/'):
+ return HttpResponsePermanentRedirect(request.path + '/')
+
+ if request.path != '/' and request.path.endswith('/') and "/admin/" not in request.path:
return HttpResponsePermanentRedirect(request.path[:-1])
+
return self.get_response(request) \ No newline at end of file