diff --git a/shelfzilla/apps/homepage/views.py b/shelfzilla/apps/homepage/views.py index 34c94ea..c7d8597 100644 --- a/shelfzilla/apps/homepage/views.py +++ b/shelfzilla/apps/homepage/views.py @@ -3,7 +3,7 @@ from django.template import RequestContext from django.shortcuts import render_to_response from django.db.models import Count from shelfzilla.apps.users.models import User -from shelfzilla.apps.manga.models import Volume +from shelfzilla.apps.manga.models import Volume, Series class HomepageView(View): @@ -27,6 +27,14 @@ class HomepageView(View): .filter(release_date__gt=datetime.now())\ .order_by('release_date')[:6] + # Stats + data['STATS'] = { + 'users': User.objects.count() - 1, + 'series': Series.objects.count(), + 'series_review': Series.objects.filter(for_review=True).count(), + 'volumes': Volume.objects.count(), + 'volumes_review': Volume.objects.filter(for_review=True).count(), + } ctx = RequestContext(request, data) return render_to_response(self.template, context_instance=ctx) diff --git a/shelfzilla/themes/bootflat/templates/homepage/home.html b/shelfzilla/themes/bootflat/templates/homepage/home.html index 72dec6d..44050aa 100644 --- a/shelfzilla/themes/bootflat/templates/homepage/home.html +++ b/shelfzilla/themes/bootflat/templates/homepage/home.html @@ -61,6 +61,7 @@
+

{% trans "Biggest collections" %}

@@ -78,6 +79,27 @@ {% endfor %}
+ +
+
+

{% trans "Stats" %}

+
+
    + {% if STATS.users > 100 %} +
  • + {% trans "Users" %} {{ STATS.users }} +
  • + {% endif %} +
  • + {% trans "Series" %} {{ STATS.series }} +
  • +
  • + {% trans "Volumes" %} {{ STATS.volumes }} +
  • +
+
+ +