Skip to content

Commit

Permalink
fix require_invitation option, with this active it was not possible t…
Browse files Browse the repository at this point in the history
…o vote
  • Loading branch information
Akasch committed Dec 7, 2019
1 parent 216c65e commit c2222d4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bitpoll/poll/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def can_vote(self, user: AbstractUser, request: Optional[HttpRequest] = None, is
if request:
messages.error(request, _("Login required to vote."))
return False
elif self.require_invitation and (not user.is_authenticated or user not in self.invitation_set.all().values('user')):
elif self.require_invitation and (not user.is_authenticated or not self.invitation_set.filter(user=user).exists()):
if request:
messages.error(request, _("You are not allowed to vote in this poll. You have to be invited"))
return False
Expand Down

0 comments on commit c2222d4

Please sign in to comment.