kadenios/shared/auth/views.py

20 lines
671 B
Python
Raw Normal View History

2020-12-21 00:07:07 +01:00
from django.contrib.auth import views as auth_views
from .forms import ElectionAuthForm
# #############################################################################
# Election Specific Login
# #############################################################################
2020-12-21 00:07:07 +01:00
class ElectionLoginView(auth_views.LoginView):
template_name = "auth/election_login.html"
2020-12-21 00:07:07 +01:00
authentication_form = ElectionAuthForm
def get_initial(self):
return {"election_id": self.kwargs.get("election_id")}
2020-12-21 00:07:07 +01:00
def get_context_data(self, **kwargs):
kwargs.update({"election_id": self.kwargs.get("election_id")})
return super().get_context_data(**kwargs)