IdHub/idhub/views.py

17 lines
514 B
Python
Raw Normal View History

2023-09-29 16:06:17 +00:00
from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy as _
2023-10-09 08:49:56 +00:00
from django.contrib.auth import views as auth_views
2023-09-28 09:01:14 +00:00
2023-10-09 08:49:56 +00:00
class LoginView(auth_views.LoginView):
2023-09-29 16:06:17 +00:00
template_name = 'auth/login.html'
extra_context = {
'title': _('Login'),
2023-10-09 08:49:56 +00:00
'success_url': reverse_lazy('idhub:user_dashboard'),
2023-09-29 16:06:17 +00:00
}
2023-09-28 09:01:14 +00:00
2023-10-09 08:49:56 +00:00
def get(self, request):
if request.GET.get('next'):
self.extra_context['success_url'] = request.GET.get('next')
return super().get(request)