fix redirect from login view

This commit is contained in:
Cayo Puigdefabregas 2024-07-09 13:34:57 +02:00
parent 9627904865
commit 23bf67d853
1 changed files with 3 additions and 3 deletions

View File

@ -16,17 +16,17 @@ class LoginView(auth_views.LoginView):
template_name = 'login.html'
extra_context = {
'title': _('Login'),
'success_url': reverse_lazy('dashboard:dashboard'),
'success_url': reverse_lazy('dashboard:unassigned_devices'),
# 'commit_id': settings.COMMIT,
}
def get(self, request, *args, **kwargs):
self.extra_context['success_url'] = request.GET.get(
'next',
reverse_lazy('dashboard:dashboard')
reverse_lazy('dashboard:unassigned_devices')
)
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)