Added the documentation to the success_redirect() utility in the Mia core application.

This commit is contained in:
依瑪貓 2020-07-28 19:34:14 +08:00
parent 8285c69685
commit 958e3048bb

View File

@ -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<s>. The status will be loaded upon the
next request at L</before_dispatch>. 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)))