move up `to`
This commit is contained in:
Родитель
6251328398
Коммит
8206d94d6d
|
@ -334,14 +334,14 @@ def external_href(url):
|
|||
@jinja2.contextfunction
|
||||
def get_login_link(context, to=None):
|
||||
request = context['request']
|
||||
# If to is given use that, otherwise get from request.
|
||||
to = to or request.GET.get('to')
|
||||
|
||||
# If logged in, just return the URL.
|
||||
if request.user.is_authenticated():
|
||||
return to
|
||||
|
||||
url = reverse('users.login')
|
||||
# If to is given use that, otherwise get from request.
|
||||
to = to or request.GET.get('to')
|
||||
# Don't allow loop backs to login.
|
||||
if to == url:
|
||||
to = None
|
||||
|
|
Загрузка…
Ссылка в новой задаче