Skip to content
Snippets Groups Projects
Commit b574b13d authored by Ben Adida's avatar Ben Adida
Browse files

Added choice to notify no one

parent 5c5a72e6
Branches
Tags
No related merge requests found
...@@ -30,5 +30,5 @@ class EmailVotersForm(forms.Form): ...@@ -30,5 +30,5 @@ class EmailVotersForm(forms.Form):
class TallyNotificationEmailForm(forms.Form): class TallyNotificationEmailForm(forms.Form):
subject = forms.CharField(max_length=80) subject = forms.CharField(max_length=80)
body = forms.CharField(max_length=2000, widget=forms.Textarea) body = forms.CharField(max_length=2000, widget=forms.Textarea, required=False)
send_to = forms.ChoiceField(label="Send To", choices= [('all', 'all voters'), ('voted', 'only voters who cast a ballot')]) send_to = forms.ChoiceField(label="Send To", choices= [('all', 'all voters'), ('voted', 'only voters who cast a ballot'), ('none', 'no one -- are you sure about this?')])
...@@ -886,6 +886,8 @@ def combine_decryptions(request, election): ...@@ -886,6 +886,8 @@ def combine_decryptions(request, election):
'election' : election 'election' : election
} }
# if the user opted for notifying no one, then we skip this step
if email_form.cleaned_data['send_to'] != 'none':
# exclude those who have not voted # exclude those who have not voted
if email_form.cleaned_data['send_to'] == 'voted': if email_form.cleaned_data['send_to'] == 'voted':
voter_constraints_exclude = {'vote_hash' : None} voter_constraints_exclude = {'vote_hash' : None}
...@@ -901,6 +903,7 @@ def combine_decryptions(request, election): ...@@ -901,6 +903,7 @@ def combine_decryptions(request, election):
# rapid short-message notification # rapid short-message notification
# this inherently only applies to those who have voted (for the most part) # this inherently only applies to those who have voted (for the most part)
# and this is not configurable, this is ALWAYS sent
tasks.voters_notify.delay(election_id = election.id, tasks.voters_notify.delay(election_id = election.id,
notification_template = 'notification/result.txt', notification_template = 'notification/result.txt',
extra_vars = extra_vars) extra_vars = extra_vars)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment