diff --git a/deploy/webapp_settings/production.py b/deploy/webapp_settings/production.py index fdaf8448d..6c74d2a84 100644 --- a/deploy/webapp_settings/production.py +++ b/deploy/webapp_settings/production.py @@ -32,7 +32,6 @@ } ] - # **** Other settings that might be useful to change locally INTERNAL_IPS = [ @@ -55,7 +54,6 @@ }, } - # **** Settings that might be useful in production SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https") ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https" @@ -63,11 +61,11 @@ RUNNING_TESTS = False - # This should be one of: # ELECTION_STATS # SOPN_TRACKER # RESULTS_PROGRESS +# DATA_DOWNLOAD # BY_ELECTIONS FRONT_PAGE_CTA = "None" SOPN_TRACKER_INFO = { @@ -81,10 +79,14 @@ # ("Northern Ireland", date(year=2023, month=4, day=24)), ] +DATA_DOWNLOAD_INFO = { + "election_date": "2024-07-04", + "election_name": "2024 general election", + "election_regex": "parl.2024-07-04", +} SCHEDULED_ELECTION_DATES = ["2024-05-02", "2024-05-18"] - STATICFILES_STORAGE = "ynr.storages.StaticStorage" DEFAULT_FILE_STORAGE = "ynr.storages.MediaStorage" AWS_STORAGE_BUCKET_NAME = "static-candidates.democracyclub.org.uk" @@ -95,7 +97,6 @@ AWS_BUCKET_ACL = AWS_DEFAULT_ACL AWS_QUERYSTRING_AUTH = False - CSRF_TRUSTED_ORIGINS = [ f"https://{os.environ.get('FQDN')}", ] @@ -109,7 +110,6 @@ EMAIL_HOST_USER = os.environ.get("SMTP_USERNAME") EMAIL_HOST_PASSWORD = os.environ.get("SMTP_PASSWORD") - SLACK_TOKEN = os.environ.get("SLACK_TOKEN") CELERY_IMPORTS = [ diff --git a/ynr/apps/elections/uk/templates/candidates/finder.html b/ynr/apps/elections/uk/templates/candidates/finder.html index c25463aa5..968003d3c 100644 --- a/ynr/apps/elections/uk/templates/candidates/finder.html +++ b/ynr/apps/elections/uk/templates/candidates/finder.html @@ -49,6 +49,7 @@

Open candidate information for UK elections

{% sopn_import_progress %} {% current_election_stats %} {% results_progress %} + {% data_download %} {% endif %} @@ -97,9 +98,6 @@

Open candidate information for UK elections

{{ postcode_form.as_p }} -

or

-

Get the data

-

Via our API or CSV download

{% if front_page_cta == "BY_ELECTIONS" %}
diff --git a/ynr/apps/elections/uk/templates/includes/data_download.html b/ynr/apps/elections/uk/templates/includes/data_download.html new file mode 100644 index 000000000..4a2c51777 --- /dev/null +++ b/ynr/apps/elections/uk/templates/includes/data_download.html @@ -0,0 +1,9 @@ +{% if DATA_DOWNLOAD %} +

Get the data

+

Download the CSV of all candidates standing for the {{ election_name }}:

+

Download CSV

+

Or for more advance filters and more fields, try the + custom CSV builder.

+

You can also use our candidates API or postcode lookup API.

+{% endif %} diff --git a/ynr/apps/elections/uk/templatetags/home_page_tags.py b/ynr/apps/elections/uk/templatetags/home_page_tags.py index a61a86eae..a58587ad1 100644 --- a/ynr/apps/elections/uk/templatetags/home_page_tags.py +++ b/ynr/apps/elections/uk/templatetags/home_page_tags.py @@ -250,3 +250,18 @@ def by_election_ctas(context): ballot for ballot in all_ballots if ballot.election.in_past ] return context + + +@register.inclusion_tag("includes/data_download.html", takes_context=True) +def data_download(context): + context["DATA_DOWNLOAD"] = ( + getattr(settings, "FRONT_PAGE_CTA", False) == "DATA_DOWNLOAD" + ) + + if context["DATA_DOWNLOAD"]: + context["election_date"] = settings.DATA_DOWNLOAD_INFO["election_date"] + context["election_regex"] = settings.DATA_DOWNLOAD_INFO[ + "election_regex" + ] + context["election_name"] = settings.DATA_DOWNLOAD_INFO["election_name"] + return context