Redirect user to product page on login

For the case when user is on product page and tries logging in
This commit is contained in:
PCoder 2018-10-05 08:58:54 +02:00
parent e3ec67d32c
commit 12eabc5f6c

View file

@ -346,6 +346,13 @@ class PaymentOrderView(FormView):
auth_user = authenticate(email=email, password=password) auth_user = authenticate(email=email, password=password)
if auth_user: if auth_user:
login(self.request, 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( return HttpResponseRedirect(
reverse('datacenterlight:payment') reverse('datacenterlight:payment')
) )