Skip to content

Commit

Permalink
FilingAction detail page but no transactions yet
Browse files Browse the repository at this point in the history
  • Loading branch information
palewire committed Nov 17, 2017
1 parent b46bf4d commit fc5fffd
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 2 deletions.
1 change: 1 addition & 0 deletions example/project/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
url(r'^committees/$', views.CommitteeList.as_view(), name="committee_list"),
url(r'^committees/(?P<pk>(.*))/$', views.CommitteeDetail.as_view(), name="committee_detail"),
url(r'^filings/(?P<pk>(.*))/$', views.FilingDetail.as_view(), name="filing_detail"),
url(r'^filing-actions/(?P<pk>(.*))/$', views.FilingActionDetail.as_view(), name="filingaction_detail"),
url(r'^admin/', include(admin.site.urls)),
url(r'^static/(?P<path>.*)$', serve, {
'document_root': settings.STATIC_ROOT,
Expand Down
6 changes: 5 additions & 1 deletion example/toolbox/templates/filing_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ <h4>{{ obj.date }}</h4>
<table class="table table-sm">
<tr>
<th>ID</th>
<td>{{ obj.id }}</td>
<td><a href="{% url 'filingaction_detail' obj.id %}">{{ obj.id }}</a></td>
</tr>
<tr>
<th>Classifications</th>
Expand All @@ -75,6 +75,10 @@ <h4>{{ obj.date }}</h4>
<th>Current</th>
<td>{{ obj.is_current }}</td>
</tr>
<tr>
<th>Transactions</th>
<td>{{ obj.transactions.count }}</td>
</tr>
</table>
<h5>Summary totals</h5>
<table class="table table-sm table-bordered">
Expand Down
49 changes: 49 additions & 0 deletions example/toolbox/templates/filingaction_detail.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{% extends "base.html" %}
{% load humanize %}

{% block content %}
<h1>{{ object.date}}: {{ object.filing }}</h1>
<table class="table table-sm">
<tr>
<th>ID</th>
<td>{{ object.id }}</a></td>
</tr>
<tr>
<th>Filing</th>
<td><a href="{% url 'filing_detail' object.filing.id %}">{{ object.filing }}</a></td>
</tr>
<tr>
<th>Classifications</th>
<td>{% for c in object.classification %}{{ c }}{% if not forloop.last%}, {% endif %}{% endfor %}</td>
</tr>
<tr>
<th>Description</th>
<td>{{ object.description }}</td>
</tr>
<tr>
<th>Agents</th>
<td>{% for a in object.agents.all %}{{ a }}{% if not forloop.last%}, {% endif %}{% endfor %}</td>
</tr>
<tr>
<th>Supersedes prior versions</th>
<td>{{ object.supersedes_prior_versions }}</td>
</tr>
<tr>
<th>Current</th>
<td>{{ object.is_current }}</td>
</tr>
</table>
<h3>Summary totals</h3>
<table class="table table-sm table-bordered">
<tr>
<th>Label</th>
<th class="text-right">Amount</th>
</tr>
{% for sum in object.summary_amounts.all %}
<tr>
<td>{{ sum.label }}</td>
<td class="text-right">${{ sum.amount_value|floatformat:0|intcomma }}</td>
</tr>
{% endfor %}
</table>
{% endblock %}
8 changes: 7 additions & 1 deletion example/toolbox/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
OCDPersonProxy,
OCDPartyProxy,
OCDCommitteeProxy,
OCDFilingProxy
OCDFilingProxy,
OCDFilingActionProxy
)
from opencivicdata.elections.models import CandidateContest
from django.views.generic import DetailView, ListView
Expand Down Expand Up @@ -115,3 +116,8 @@ class CommitteeDetail(DetailView):
class FilingDetail(DetailView):
model = OCDFilingProxy
template_name = "filing_detail.html"


class FilingActionDetail(DetailView):
model = OCDFilingActionProxy
template_name = "filingaction_detail.html"

0 comments on commit fc5fffd

Please sign in to comment.