From 5449a4fca2e864606cd22d55cd7673174c212a07 Mon Sep 17 00:00:00 2001 From: klmp200 Date: Sun, 25 Dec 2016 22:04:31 +0100 Subject: [PATCH] Little permission fix --- election/templates/election/election_detail.jinja | 2 ++ election/views.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/election/templates/election/election_detail.jinja b/election/templates/election/election_detail.jinja index f87cd971..ce052d8f 100644 --- a/election/templates/election/election_detail.jinja +++ b/election/templates/election/election_detail.jinja @@ -362,7 +362,9 @@ th { {%- endif %} {% trans %}Add a new list{% endtrans %} {%- if user.can_edit(election) %} + {% if election.is_vote_editable %} {% trans %}Add a new role{% endtrans %} + {% endif %} {% trans %}Edit{% endtrans %} {%- endif %} diff --git a/election/views.py b/election/views.py index 4dd56448..579b8cf2 100644 --- a/election/views.py +++ b/election/views.py @@ -289,7 +289,7 @@ class RoleCreateView(CanCreateMixin, CreateView): def dispatch(self, request, *arg, **kwargs): self.election = get_object_or_404(Election, pk=kwargs['election_id']) - if self.election.is_vote_editable: + if not self.election.is_vote_editable: raise PermissionDenied return super(RoleCreateView, self).dispatch(request, *arg, **kwargs)