diff options
Diffstat (limited to 'core/middleware.py')
-rw-r--r-- | core/middleware.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/middleware.py b/core/middleware.py index e87662e..06c159a 100644 --- a/core/middleware.py +++ b/core/middleware.py @@ -44,11 +44,11 @@ class SmartAppendSlashMiddleware(object): else: if settings.DEBUG and request.method == 'POST': # replace this exception with a redirect to an error page - raise RuntimeError("You called this URL via POST, but the URL doesn't end in a slash and you have SMART_APPEND_SLASH set. Django can't redirect to the slash URL while maintaining POST data. Change your form to point to %s%s (note the trailing slash), or set SMART_APPEND_SLASH=False in your Django settings." % (new_url[0], new_url[1])) + raise RuntimeError(f"You called this URL via POST, but the URL doesn't end in a slash and you have SMART_APPEND_SLASH set. Django can't redirect to the slash URL while maintaining POST data. Change your form to point to {new_url[0]}{new_url[1]} (note the trailing slash), or set SMART_APPEND_SLASH=False in your Django settings.") if new_url != old_url: # Redirect if new_url[0]: - newurl = "%s://%s%s" % (request.is_secure() and 'https' or 'http', new_url[0], new_url[1]) + newurl = f"{request.is_secure() and 'https' or 'http'}://{new_url[0]}{new_url[1]}" else: newurl = new_url[1] if request.GET: |