From 958e3048bb04e4afcf5005b6ed2c1c1d226a1afe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Tue, 28 Jul 2020 19:34:14 +0800 Subject: [PATCH] Added the documentation to the success_redirect() utility in the Mia core application. --- mia_core/status.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mia_core/status.py b/mia_core/status.py index 7404474..1ea15dc 100644 --- a/mia_core/status.py +++ b/mia_core/status.py @@ -26,6 +26,18 @@ from mia_core.utils import UrlBuilder def success_redirect(request, url, success): + """Redirects to a specific URL on error, with the status ID appended + as the query parameter I. The status will be loaded upon the + next request at L. You have to return and exit + from the controller manually after the redirection. + + Args: + url (str): The destination URL. + success (str): The success text message. + + Returns: + HttpResponseRedirect: The redirect response. + """ id = _store(request, {"success": success}) return HttpResponseRedirect(str(UrlBuilder(url).add_param("s", id)))