1👍
✅
Override method get_context_data
on class LoginView
.
def get_context_data(self, **kwargs):
context = super(LoginView, self).get_context_data(**kwargs)
context['next'] = self.request.REQUEST.get('next')
return context
This assumes that the GET
parameter will have the next url where user should be redirected in param next
. So, request should be of form localhost.com/login?next=/accounts/
Source:stackexchange.com