forms.py 1.77 KiB
"""
Forms for Helios
"""
from django import forms
from models import Election
from widgets import *
from fields import *
class ElectionForm(forms.Form):
short_name = forms.SlugField(max_length=25, help_text='no spaces, will be part of the URL for your election, e.g. my-club-2010')
name = forms.CharField(max_length=100, widget=forms.TextInput(attrs={'size':60}), help_text='the pretty name for your election, e.g. My Club 2010 Election')
description = forms.CharField(max_length=2000, widget=forms.Textarea(attrs={'cols': 70, 'wrap': 'soft'}))
use_voter_aliases = forms.BooleanField(required=False, initial=False, help_text='if selected, voter identities will be replaced with aliases, e.g. "V12", in the ballot tracking center')
class ElectionTimesForm(forms.Form):
# times
voting_starts_at = SplitDateTimeField(help_text = 'UTC date and time when voting begins',
widget=SplitSelectDateTimeWidget)
voting_ends_at = SplitDateTimeField(help_text = 'UTC date and time when voting ends',
widget=SplitSelectDateTimeWidget)
class EmailVotersForm(forms.Form):
subject = forms.CharField(max_length=80)
body = forms.CharField(max_length=2000, widget=forms.Textarea)
suppress_election_links = forms.BooleanField(label = "Suppress links?", required=False)
send_to = forms.ChoiceField(label="Send To", choices= [('all', 'all voters'), ('voted', 'voters who have cast a ballot'), ('not-voted', 'voters who have not yet cast a ballot')])
class TallyNotificationEmailForm(forms.Form):
subject = forms.CharField(max_length=80)
body = forms.CharField(max_length=2000, widget=forms.Textarea)
send_to = forms.ChoiceField(label="Send To", choices= [('all', 'all voters'), ('voted', 'only voters who cast a ballot')])