fix redirect from login view
This commit is contained in:
parent
9627904865
commit
23bf67d853
|
@ -16,17 +16,17 @@ class LoginView(auth_views.LoginView):
|
||||||
template_name = 'login.html'
|
template_name = 'login.html'
|
||||||
extra_context = {
|
extra_context = {
|
||||||
'title': _('Login'),
|
'title': _('Login'),
|
||||||
'success_url': reverse_lazy('dashboard:dashboard'),
|
'success_url': reverse_lazy('dashboard:unassigned_devices'),
|
||||||
# 'commit_id': settings.COMMIT,
|
# 'commit_id': settings.COMMIT,
|
||||||
}
|
}
|
||||||
|
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
self.extra_context['success_url'] = request.GET.get(
|
self.extra_context['success_url'] = request.GET.get(
|
||||||
'next',
|
'next',
|
||||||
reverse_lazy('dashboard:dashboard')
|
reverse_lazy('dashboard:unassigned_devices')
|
||||||
)
|
)
|
||||||
if not self.request.user.is_anonymous:
|
if not self.request.user.is_anonymous:
|
||||||
return redirect(reverse_lazy('dashboard:dashboard'))
|
return redirect(reverse_lazy('dashboard:unassigned_devices'))
|
||||||
|
|
||||||
return super().get(request, *args, **kwargs)
|
return super().get(request, *args, **kwargs)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue