Django login redirect_field_name 'next' forces new session
0
I'm building an e-commerce website, I enable guest users to add products to their carts saving the cart_id in session and when they proceed to checkout, I redirect them to login as follows inside the checkout view if not request.user.is_authenticated: login_url = reverse('accounts:login') check_out_url = reverse('cart:checkout') redirect_url = "{}?next={}".format(login_url, check_out_url) return redirect(redirect_url) # checkout process here It works, however the cart_id is no longer in the session. If I don't use the next parameter and just redirect to login_url the cart_id stays in session. P.S: Same thing happens with login_required_decorator Is there a way to keep the session data intact ?
django d...