diff --git a/allauthdemo/polls/models.py b/allauthdemo/polls/models.py
index 6fbabfe..13b872e 100755
--- a/allauthdemo/polls/models.py
+++ b/allauthdemo/polls/models.py
@@ -205,6 +205,7 @@ class PartialBallotDecryption(models.Model):
class Ballot(models.Model):
voter = models.ForeignKey(EmailUser, on_delete=models.CASCADE, related_name="ballots")
poll = models.ForeignKey(Poll, on_delete=models.CASCADE, related_name="ballots")
+ selection = models.CharField(max_length=1)
cast = models.BooleanField(default=False)
diff --git a/allauthdemo/polls/views.py b/allauthdemo/polls/views.py
index c498fbe..0799c14 100755
--- a/allauthdemo/polls/views.py
+++ b/allauthdemo/polls/views.py
@@ -47,6 +47,9 @@ class EventDetailView(generic.DetailView):
for poll in polls:
result_json = poll.result_json
+ if result_json is None:
+ continue
+
if result_json[len(result_json)-1] == ',':
result_json = result_json[0:len(result_json)-1]
@@ -184,6 +187,7 @@ def event_vote(request, event_id, poll_id):
if request.method == "POST":
ballot_json = json.loads(request.POST.get('ballot'))
+ selection = request.POST.get('selection')
encrypted_votes_json = ballot_json['encryptedVotes']
enc_ballot_json = request.POST.get('encBallot')
@@ -213,6 +217,7 @@ def event_vote(request, event_id, poll_id):
cipher_text_c2=fragment['C2'])
ballot.cast = True
+ ballot.selection = selection
ballot.save()
combine_encrypted_votes.delay(email_key[0].user, poll)
diff --git a/allauthdemo/templates/polls/event_vote.html b/allauthdemo/templates/polls/event_vote.html
index b980b5e..563fa43 100755
--- a/allauthdemo/templates/polls/event_vote.html
+++ b/allauthdemo/templates/polls/event_vote.html
@@ -28,9 +28,9 @@
Voting status:
{% if has_voted %}
- Voted - Re-Submitting will Change your Vote
+ Voted - Re-submitting will change your vote
{% else %}
- Not Voted
+ Not Voted
{% endif %}
@@ -105,13 +105,12 @@
-