login admin to admin_dashboard

This commit is contained in:
Cayo Puigdefabregas 2023-11-21 14:45:37 +01:00
parent 4a7a43fbe5
commit b3cd5e656d
1 changed files with 4 additions and 0 deletions

View File

@ -11,6 +11,10 @@ class LoginView(auth_views.LoginView):
}
def get(self, request, *args, **kwargs):
if request.user.is_admin:
self.extra_context['success_url'] = reverse_lazy(
'idhub:admin_dashboard'
)
if request.GET.get('next'):
self.extra_context['success_url'] = request.GET.get('next')
return super().get(request, *args, **kwargs)