from django.contrib.auth import views as auth_views

from .forms import ElectionAuthForm

# #############################################################################
#  Election Specific Login
# #############################################################################


class ElectionLoginView(auth_views.LoginView):
    template_name = "auth/election_login.html"
    authentication_form = ElectionAuthForm

    def get_initial(self):
        return {"election_id": self.kwargs.get("election_id")}

    def get_context_data(self, **kwargs):
        kwargs.update({"election_id": self.kwargs.get("election_id")})
        return super().get_context_data(**kwargs)
