Skip to content

Commit

Permalink
Merge pull request #222 from datamade/feature/37-lobbyist-dl-page
Browse files Browse the repository at this point in the history
Add separate lobbyist download page
  • Loading branch information
antidipyramid authored Oct 28, 2024
2 parents acfe938 + 73e2d8a commit 4017fc4
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 46 deletions.
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"
),
# 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 %}

0 comments on commit 4017fc4

Please sign in to comment.