Skip to content
Snippets Groups Projects
Select Git revision
  • a374b4491dd6308e15f61468d2f075044ae8d765
  • test default protected
  • master protected
  • original
  • pirati-backup protected
  • beta-2
  • beta-1
  • v3.1.4
  • v3.1.3
  • v3.1.2
  • v3.1.1
  • v3.1.0
  • v3.0.16
  • v3.0.15
  • v3.0.14
  • v3.0.13
  • v3.0.12
  • v3.0.11
  • v3.0.10
  • v3.0.9
  • v3.0.8
  • v3.0.7
  • v3.0.6
  • v3.0.5
  • v3.0.4
25 results

forms.py

Blame
  • user avatar
    Ben Adida authored
    02282f41
    History
    forms.py 2.98 KiB
    """
    Forms for Helios
    """
    
    from django import forms
    from models import Election
    from widgets import *
    from fields import *
    from django.conf import settings
    
    
    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=4000, widget=forms.Textarea(attrs={'cols': 70, 'wrap': 'soft'}), required=False)
      election_type = forms.ChoiceField(label="type", choices = Election.ELECTION_TYPES)
      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')
      #use_advanced_audit_features = forms.BooleanField(required=False, initial=True, help_text='disable this only if you want a simple election with reduced security but a simpler user interface')
      randomize_answer_order = forms.BooleanField(required=False, initial=False, help_text='enable this if you want the answers to questions to appear in random order for each voter')
      private_p = forms.BooleanField(required=False, initial=False, label="Private?", help_text='A private election is only visible to registered voters.')
      help_email = forms.CharField(required=False, initial="", label="Help Email Address", help_text='An email address voters should contact if they need help.')
      
      if settings.ALLOW_ELECTION_INFO_URL:
        election_info_url = forms.CharField(required=False, initial="", label="Election Info Download URL", help_text="the URL of a PDF document that contains extra election information, e.g. candidate bios and statements")
      
    
    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=4000, widget=forms.Textarea)
      send_to = forms.ChoiceField(label="Send To", initial="all", 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, required=False)
      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?')])
    
    class VoterPasswordForm(forms.Form):
      voter_id = forms.CharField(max_length=50, label="Voter ID")
      password = forms.CharField(widget=forms.PasswordInput(), max_length=100)