From 12eabc5f6c56580d00e098bee17dcf028e4f5bbc Mon Sep 17 00:00:00 2001 From: PCoder Date: Fri, 5 Oct 2018 08:58:54 +0200 Subject: [PATCH] Redirect user to product page on login For the case when user is on product page and tries logging in --- datacenterlight/views.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index 63ed94c7..aa404db5 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -346,6 +346,13 @@ class PaymentOrderView(FormView): auth_user = authenticate(email=email, password=password) if auth_user: login(self.request, auth_user) + if 'product_slug' in kwargs: + return HttpResponseRedirect( + reverse('show_product', + kwargs={ + 'product_slug': kwargs['product_slug']} + ) + ) return HttpResponseRedirect( reverse('datacenterlight:payment') )