Skip to content
Snippets Groups Projects
Select Git revision
  • f1ce2f97a6d8d938fbfe800ffda6820ac0af0850
  • 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

models.py

Blame
  • glue.py 1.01 KiB
    """
    Glue some events together 
    """
    
    from django.conf import settings
    from django.core.urlresolvers import reverse
    from django.conf import settings
    import helios.views, helios.signals
    
    import views
    
    def vote_cast_send_message(user, voter, election, cast_vote, **kwargs):
      # prepare the message
      subject = "%s - vote cast" % election.name
      
      body = """
    You have successfully cast a vote in
    
      %s
      
    Your ballot tracking number is:
    
      %s
    """ % (election.name, cast_vote.vote_hash)
      
      if election.use_voter_aliases:
        body += """
    
    This election uses voter aliases to protect your privacy.
    Your voter alias is : %s    
    """ % voter.alias
    
      body += """
    
    --
    %s
    """ % settings.SITE_TITLE  
      
      # send it via the notification system associated with the auth system
      user.send_message(subject, body)
    
    import logging
    logging.error("connecting the vote_cast signal")
    helios.signals.vote_cast.connect(vote_cast_send_message)
    
    def election_tallied(election, **kwargs):
      pass
    
    helios.signals.election_tallied.connect(election_tallied)