Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add separate lobbyist download page #222

Merged
merged 5 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion camp_fin/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@
</a>
<ul class="dropdown-menu">
<li>
<a href="{% url 'downloads' %}">Campaign finance</a>
<a href="{% url 'camp-fin-downloads' %}">Campaign finance</a>
</li>
<li>
<a href="{% url 'lobbyist-downloads' %}">Lobbyists</a>
</li>
</ul>
</li>
Expand Down
20 changes: 18 additions & 2 deletions camp_fin/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""

from django.contrib import admin
from django.urls import include, path
from django.views.generic import RedirectView
from rest_framework import routers

from camp_fin.views import (
AboutView,
CampaignFinanceDownloadView,
CandidateDetail,
CandidateList,
CommitteeDetail,
Expand All @@ -27,13 +30,13 @@
ContributionDownloadViewSet,
ContributionViewSet,
DonationsView,
DownloadView,
ExpenditureDetail,
ExpenditureDownloadViewSet,
ExpenditureViewSet,
FinancialDisclosuresView,
IndexView,
LoanViewSet,
LobbyistDownloadView,
LobbyistsView,
OrganizationDetail,
OrganizationList,
Expand Down Expand Up @@ -107,7 +110,20 @@
CommitteeDetail.as_view(),
name="committee-detail",
),
path("downloads/", DownloadView.as_view(), name="downloads"),
path(
"camp-fin-downloads/",
CampaignFinanceDownloadView.as_view(),
name="camp-fin-downloads",
),
path(
"lobbyist-downloads/", LobbyistDownloadView.as_view(), name="lobbyist-downloads"
),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add a 301 redirect from downlods to camp-find-downloads.

# Redirect requests to the old downloads page to campaign finance downloads
path(
"downloads/",
RedirectView.as_view(permanent=True, url="/camp-fin-downloads/"),
name="downloads",
),
path("organizations/", OrganizationList.as_view(), name="organization-list"),
path(
r"organizations/<slug:slug>/",
Expand Down
26 changes: 23 additions & 3 deletions camp_fin/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ def get_context_data(self, **kwargs):
return context


class DownloadView(PagesMixin):
template_name = "downloads.html"
page_path = "/downloads/"
class CampaignFinanceDownloadView(PagesMixin):
template_name = "camp_fin_downloads.html"
page_path = "/camp-fin-downloads/"

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
Expand All @@ -155,6 +155,26 @@ def get_context_data(self, **kwargs):
return context


class LobbyistDownloadView(PagesMixin):
template_name = "lobbyist_downloads.html"
page_path = "/lobbyist-downloads/"

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)

seo = {}
seo.update(settings.SITE_META)

seo["title"] = "Data downloads"
seo[
"site_desc"
] = "Download campaign finance data from New Mexico In Depth’s Money Trail NM"

context["seo"] = seo

return context


class LobbyistContextMixin(object):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,46 +67,6 @@ <h4 class="col-xs-12">
<br/><br />
</div>
</div>

<div class="row mb-3">
<h3>
<i class="fa fa-table"></i>
Independent Expenditures
</h3>
<a href="https://openness-project-nmid.s3.amazonaws.com/independent_expenditures.xlsx" target="_blank">
Download Independent Expenditures Spreadsheet
</a>
<div class="col-xs-12">
<br/><br />
</div>
</div>

<div class="row mb-3">
<h3>
<i class="fa fa-table"></i>
Lobbyist Employer
</h3>
<a href="https://openness-project-nmid.s3.amazonaws.com/lobbyist_employer.xlsx" target="_blank">
Download Lobbyist Employer Spreadsheet
</a>
<div class="col-xs-12">
<br/><br />
</div>
</div>

<div class="row mb-3">
<h3>
<i class="fa fa-table"></i>
Lobbyist
</h3>
<a href="https://openness-project-nmid.s3.amazonaws.com/lobbyist.xlsx" target="_blank">
Download Lobbyist Spreadsheet
</a>
<div class="col-xs-12">
<br/><br />
</div>
</div>

</div>
</div>

Expand Down
57 changes: 57 additions & 0 deletions pages/templates/lobbyist_downloads.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{% extends 'base.html' %}
{% load static %}

{% block title %}Data downloads{% endblock %}

{% block full_content %}
<div class="container">
<div class='row'>
<div class='col-sm-8 col-sm-offset-2'>
<h1 id='download'><i class='fa fa-fw fa-download'></i> Lobbyist data downloads</h1>
<hr />
{{ page.text|safe }}

<div class="row mb-3">
<h3>
<i class="fa fa-table"></i>
Independent Expenditures
</h3>
<a href="https://openness-project-nmid.s3.amazonaws.com/independent_expenditures.xlsx" target="_blank">
Download Independent Expenditures Spreadsheet
</a>
<div class="col-xs-12">
<br/><br />
</div>
</div>

<div class="row mb-3">
<h3>
<i class="fa fa-table"></i>
Lobbyist Employer
</h3>
<a href="https://openness-project-nmid.s3.amazonaws.com/lobbyist_employer.xlsx" target="_blank">
Download Lobbyist Employer Spreadsheet
</a>
<div class="col-xs-12">
<br/><br />
</div>
</div>

<div class="row mb-3">
<h3>
<i class="fa fa-table"></i>
Lobbyist
</h3>
<a href="https://openness-project-nmid.s3.amazonaws.com/lobbyist.xlsx" target="_blank">
Download Lobbyist Spreadsheet
</a>
<div class="col-xs-12">
<br/><br />
</div>
</div>

</div>
</div>

</div>
{% endblock %}
Loading