diff options
| author | Carlton Gibson <carlton.gibson@noumenal.es> | 2020-10-20 09:14:48 +0200 |
|---|---|---|
| committer | Carlton Gibson <carlton@noumenal.es> | 2020-10-22 14:15:19 +0200 |
| commit | ad11f5b8c9cbfdb763e08c83170694abc0c5fc1e (patch) | |
| tree | 28647127cf0bc05120bee7417609ec997a5b1f96 /django/middleware/common.py | |
| parent | 34180922380cf41cd684f846ecf00f92eb289bcf (diff) | |
Fixed #32124 -- Added per-view opt-out for APPEND_SLASH behavior.
Diffstat (limited to 'django/middleware/common.py')
| -rw-r--r-- | django/middleware/common.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/django/middleware/common.py b/django/middleware/common.py index e6f30f44ad..3af4759109 100644 --- a/django/middleware/common.py +++ b/django/middleware/common.py @@ -67,10 +67,11 @@ class CommonMiddleware(MiddlewareMixin): """ if settings.APPEND_SLASH and not request.path_info.endswith('/'): urlconf = getattr(request, 'urlconf', None) - return ( - not is_valid_path(request.path_info, urlconf) and - is_valid_path('%s/' % request.path_info, urlconf) - ) + if not is_valid_path(request.path_info, urlconf): + match = is_valid_path('%s/' % request.path_info, urlconf) + if match: + view = match.func + return getattr(view, 'should_append_slash', True) return False def get_full_path_with_slash(self, request): |
