1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Redirect user to previous page after logging in

This commit is contained in:
Jeremy Stretch
2016-10-13 16:12:27 -04:00
parent 464797858f
commit 579ed0a985

View File

@ -12,4 +12,4 @@ class LoginRequiredMiddleware:
def process_request(self, request):
if LOGIN_REQUIRED and not request.user.is_authenticated():
if request.path_info != settings.LOGIN_URL:
return HttpResponseRedirect(settings.LOGIN_URL)
return HttpResponseRedirect('{}?next={}'.format(settings.LOGIN_URL, request.path_info))