fixed redirect link
This commit is contained in:
parent
59be6a7413
commit
47be413298
1 changed files with 2 additions and 1 deletions
|
@ -40,6 +40,8 @@ class LoginViewMixin(FormView):
|
||||||
|
|
||||||
def get_success_url(self):
|
def get_success_url(self):
|
||||||
next_url = self.request.POST.get('next', self.success_url)
|
next_url = self.request.POST.get('next', self.success_url)
|
||||||
|
if not next_url:
|
||||||
|
return self.success_url
|
||||||
return next_url
|
return next_url
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
|
@ -54,7 +56,6 @@ class LoginViewMixin(FormView):
|
||||||
return HttpResponseRedirect(self.get_success_url())
|
return HttpResponseRedirect(self.get_success_url())
|
||||||
|
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
|
|
||||||
if self.request.user.is_authenticated():
|
if self.request.user.is_authenticated():
|
||||||
return HttpResponseRedirect(self.get_success_url())
|
return HttpResponseRedirect(self.get_success_url())
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue