diff --git a/helios/forms.py b/helios/forms.py index a5263fa78..81c176678 100644 --- a/helios/forms.py +++ b/helios/forms.py @@ -6,6 +6,8 @@ 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 diff --git a/helios/templates/election_view.html b/helios/templates/election_view.html index 3f8c04c06..5e2afff65 100644 --- a/helios/templates/election_view.html +++ b/helios/templates/election_view.html @@ -50,6 +50,9 @@
questions ({% if election.questions %}{{election.questions|length}}{% else %}0{% endif %}) diff --git a/helios/views.py b/helios/views.py index 40da9a128..388fa99e3 100644 --- a/helios/views.py +++ b/helios/views.py @@ -231,6 +231,9 @@ def one_election_edit(request, election): error = None 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 = {} diff --git a/settings.py b/settings.py index c9485ffd5..5c90c6a36 100644 --- a/settings.py +++ b/settings.py @@ -175,8 +175,8 @@ def get_from_env(var, default): # 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', '[]'))