Commit c0174ede authored by Daniel W Bond's avatar Daniel W Bond
Browse files

finished off adding listing charts

parent dab012de
......@@ -4,6 +4,8 @@ from core.models import Student
from django.views.generic import TemplateView
from django.db.models import Sum
from collections import Counter
class HomepageView(TemplateView):
......@@ -43,4 +45,5 @@ class ChartsView(TemplateView):
context['total_listings'] = all_listings.count()
context['total_bids'] = Bid.objects.count()
context['total_students'] = Student.objects.count()
context['total_proceeds'] = Listing.objects.aggregate(sum_price=Sum('winning_bid__price'))['sum_price']
return context
......@@ -22,6 +22,7 @@ SRCT Bookshare • Charts
<div class="row">
<div class="col-md-12 text-center">
<p><h2>Featuring <strong>{{ total_bids|intcomma }} bids</strong> on <strong>{{ total_listings|intcomma }} listings</strong> from <strong>{{ total_students|intcomma }} students</strong> (so far).</h2></p>
<p><h2>Total Proceeds: <strong>${{ total_proceeds|intcomma }}</strong></h2></p>
</div>
</div>
......
......@@ -15,6 +15,7 @@
{% if user.is_authenticated %}
<li><a href="{% url 'create_listing' %}">Create Listing</a></li>
<li><a href="{% url 'list_listings' %}">Latest Listings</a></li>
<li><a href="{% url 'charts' %}">Listing Charts</a></li>
{% else %}
<li><a href="{% url 'about' %}">About</a></li>
{% endif %}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment