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

added ability to set an election_info_url, eg downloadable candidate bios,...

added ability to set an election_info_url, eg downloadable candidate bios, with a settings flag to enable this
parent 8333df85
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,8 @@ 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')
......@@ -18,6 +20,9 @@ class ElectionForm(forms.Form):
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
......
......@@ -50,6 +50,9 @@ this {{election.election_type}} is <u>not</u> featured on the front page.
{{election.description}}
</div>
{% if election.election_info_url %}
<p style="font-size:1.5em;">[<a href="{{election.election_info_url}}">download election info</a>]</p>
{% endif %}
<p align="center" style="font-size: 1.5em;">
<a href="{% url helios.views.one_election_questions election.uuid %}">questions ({% if election.questions %}{{election.questions|length}}{% else %}0{% endif %})</a>
......
......@@ -232,6 +232,9 @@ def one_election_edit(request, election):
RELEVANT_FIELDS = ['short_name', 'name', 'description', 'use_voter_aliases', 'election_type', 'private_p', 'help_email', 'randomize_answer_order']
# RELEVANT_FIELDS += ['use_advanced_audit_features']
if settings.ALLOW_ELECTION_INFO_URL:
RELEVANT_FIELDS += ['election_info_url']
if request.method == "GET":
values = {}
for attr_name in RELEVANT_FIELDS:
......
......@@ -175,8 +175,8 @@ SOCIALBUTTONS_URL_HOST= get_from_env("SOCIALBUTTONS_URL_HOST", "http://localhost
# election stuff
SITE_TITLE = get_from_env('SITE_TITLE', 'Helios Voting')
MAIN_LOGO_URL = get_from_env('MAIN_LOGO_URL', '/static/logo.png')
ALLOW_ELECTION_INFO_URL = (get_from_env('ALLOW_ELECTION_INFO_URL', '0') == '1')
# FOOTER links
FOOTER_LINKS = json.loads(get_from_env('FOOTER_LINKS', '[]'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment