2020-12-21 00:07:07 +01:00
|
|
|
from django.contrib.auth import views as auth_views
|
|
|
|
|
|
|
|
from .forms import ElectionAuthForm
|
|
|
|
|
2021-01-27 13:52:35 +01:00
|
|
|
# #############################################################################
|
|
|
|
# Election Specific Login
|
|
|
|
# #############################################################################
|
2020-12-21 00:07:07 +01:00
|
|
|
|
|
|
|
|
2021-01-27 13:52:35 +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):
|
2021-01-27 13:52:35 +01:00
|
|
|
return {"election_id": self.kwargs.get("election_id")}
|
2020-12-21 00:07:07 +01:00
|
|
|
|
2021-01-27 13:52:35 +01:00
|
|
|
def get_context_data(self, **kwargs):
|
|
|
|
kwargs.update({"election_id": self.kwargs.get("election_id")})
|
|
|
|
return super().get_context_data(**kwargs)
|