From 2e2bf603b8ce063e638e0552d5c76dc8838c04cb Mon Sep 17 00:00:00 2001 From: Patrick Date: Thu, 14 Jan 2021 11:55:57 +0000 Subject: [PATCH] add redirect to current page after login --- fet2020/authentications/views.py | 6 +++++- fet2020/templates/layout.html | 10 +++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/fet2020/authentications/views.py b/fet2020/authentications/views.py index bbf8b0a3..2c9cc80e 100644 --- a/fet2020/authentications/views.py +++ b/fet2020/authentications/views.py @@ -25,7 +25,11 @@ def loginPage(request): user = User.objects.create_user(auth_user.lower()) login(request, user) - return redirect('home') + + try: + return redirect(request.GET.get('next')) + except: + return redirect('home') else: messages.info(request, 'username or password is incorrect') diff --git a/fet2020/templates/layout.html b/fet2020/templates/layout.html index c82f2b55..57f941b5 100644 --- a/fet2020/templates/layout.html +++ b/fet2020/templates/layout.html @@ -50,19 +50,19 @@ footer {