On renvoie sur la vue de l'élection si on essaie de voter sans être connecté
This commit is contained in:
parent
d3e3ff23ce
commit
eeab71bad9
1 changed files with 8 additions and 0 deletions
|
@ -454,6 +454,14 @@ class VoteView(OpenElectionOnlyMixin, DetailView):
|
||||||
model = Question
|
model = Question
|
||||||
template_name = "elections/vote.html"
|
template_name = "elections/vote.html"
|
||||||
|
|
||||||
|
def dispatch(self, request, *args, **kwargs):
|
||||||
|
# Si l'utilisateur n'est pas connecté on renvoie sur la vue de l'élection
|
||||||
|
if not request.user.is_authenticated:
|
||||||
|
return HttpResponseRedirect(
|
||||||
|
reverse("election.view", args=[super().get_object().election.pk])
|
||||||
|
)
|
||||||
|
return super().dispatch(request, *args, **kwargs)
|
||||||
|
|
||||||
def get_next_url(self):
|
def get_next_url(self):
|
||||||
return reverse("election.view", args=[self.object.election.pk])
|
return reverse("election.view", args=[self.object.election.pk])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue