2019-11-05 10:46:29 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
2024-12-18 09:25:40 +00:00
|
|
|
from urllib.parse import urlencode, parse_qsl
|
|
|
|
|
2019-11-05 10:46:29 +00:00
|
|
|
from django.shortcuts import reverse, redirect
|
|
|
|
|
|
|
|
|
2024-12-18 09:25:40 +00:00
|
|
|
def redirect_to_guard_view(comment='', query_string=None):
|
|
|
|
params = {'_': comment}
|
|
|
|
base_url = reverse('authentication:login-guard')
|
|
|
|
|
|
|
|
if query_string:
|
|
|
|
params.update(dict(parse_qsl(query_string)))
|
|
|
|
|
|
|
|
query_string = urlencode(params)
|
|
|
|
|
|
|
|
continue_url = f"{base_url}?{query_string}"
|
2019-11-05 10:46:29 +00:00
|
|
|
return redirect(continue_url)
|