add a stats page
This commit is contained in:
parent
62b13cd684
commit
a7b35c6883
|
@ -0,0 +1,28 @@
|
|||
{% extends "explorer/base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<link rel="stylesheet" type="text/css" href="/static/tn.css" />
|
||||
<div class="boxed">
|
||||
<h1>Explorer statistics</h1>
|
||||
|
||||
<p>Total bills: {{ all }}</p>
|
||||
|
||||
<p>Red Senate Bills: {{ red_senate }}</p>
|
||||
|
||||
<p>White Senate Bills: {{ white_senate }}</p>
|
||||
|
||||
<p>Blue Senate Bills: {{ blue_senate }}</p>
|
||||
|
||||
<p>Red House Bills: {{ red_house }}</p>
|
||||
|
||||
<p>White House Bills: {{ white_house }}</p>
|
||||
|
||||
<p>Blue House Bills: {{ blue_house }}</p>
|
||||
|
||||
<p>Red General Assembly Bills: {{ red_ga }}</p>
|
||||
|
||||
<p>White General Assembly Bills: {{ white_ga }}</p>
|
||||
|
||||
<p>Blue General Assembly Bills: {{ blue_ga }}</p>
|
||||
</div>
|
||||
{% endblock content %}
|
|
@ -5,6 +5,7 @@ from . import views
|
|||
urlpatterns = [
|
||||
path("", views.index, name="index"),
|
||||
path("all/", views.all, name="all"),
|
||||
path("stats/", views.stats, name="stats"),
|
||||
path("legislation/<int:legislation_id>/", views.view_legislation, name="viewleg"),
|
||||
path("conference/<int:conference_id>/", views.view_conference, name="viewconf"),
|
||||
]
|
||||
|
|
|
@ -37,3 +37,19 @@ def view_conference(request, conference_id):
|
|||
"sample": results[0]
|
||||
}
|
||||
return render(request, "explorer/conference.html", context)
|
||||
|
||||
def stats(request):
|
||||
all_legislation = len(LegislativeText.objects.all())
|
||||
context = {
|
||||
"all": all_legislation,
|
||||
"red_senate": len(LegislativeText.objects.filter(assembly="RSB")),
|
||||
"blue_senate": len(LegislativeText.objects.filter(assembly="BSB")),
|
||||
"white_senate": len(LegislativeText.objects.filter(assembly="WSB")),
|
||||
"red_house": len(LegislativeText.objects.filter(assembly="RHB")),
|
||||
"blue_house": len(LegislativeText.objects.filter(assembly="BHB")),
|
||||
"white_house": len(LegislativeText.objects.filter(assembly="WHB")),
|
||||
"red_ga": len(LegislativeText.objects.filter(assembly="RGA")),
|
||||
"blue_ga": len(LegislativeText.objects.filter(assembly="BGA")),
|
||||
"white_ga": len(LegislativeText.objects.filter(assembly="WGA")),
|
||||
}
|
||||
return render(request, "explorer/stats.html", context)
|
||||
|
|
Loading…
Reference in New Issue