Преглед изворни кода

Redirect user to previous page after logging in

Jeremy Stretch пре 9 година
родитељ
комит
579ed0a985
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      netbox/utilities/middleware.py

+ 1 - 1
netbox/utilities/middleware.py

@@ -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))