{{ volume }}
+
+ {{ volume.publisher }}
+ {{ volume.release_date }}
+
diff --git a/shelfzilla/apps/homepage/views.py b/shelfzilla/apps/homepage/views.py index 0bca071..564a0c0 100644 --- a/shelfzilla/apps/homepage/views.py +++ b/shelfzilla/apps/homepage/views.py @@ -1,11 +1,26 @@ from django.views.generic import View 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 class HomepageView(View): template = 'homepage/home.html' def get(self, request): - ctx = RequestContext(request, {}) + data = {} + from datetime import datetime + # TOP 5 + data['TOP_5_COLLECTORS'] = User.objects.all()\ + .annotate(num_volumes=Count('have_volumes'))\ + .order_by('-num_volumes')[:5] + + # Latest manga added + data['LATEST_MANGA_ADDED'] = Volume.objects\ + .filter(release_date__lte=datetime.now())\ + .order_by('-release_date')[:12] + + ctx = RequestContext(request, data) return render_to_response(self.template, context_instance=ctx) diff --git a/shelfzilla/themes/bootflat/static/less/layout.less b/shelfzilla/themes/bootflat/static/less/layout.less index 14220b9..a376914 100644 --- a/shelfzilla/themes/bootflat/static/less/layout.less +++ b/shelfzilla/themes/bootflat/static/less/layout.less @@ -46,3 +46,18 @@ body { } } } + +.list-group-item.list-group-users { + .avatar { + height: 20px; + display: inline-block; + } +} + +.latest-manga { + .item { + min-height: 100px; + + .content { padding-left: 86px; } + } +} diff --git a/shelfzilla/themes/bootflat/templates/homepage/home.html b/shelfzilla/themes/bootflat/templates/homepage/home.html index b22ae2c..c11f7d6 100644 --- a/shelfzilla/themes/bootflat/templates/homepage/home.html +++ b/shelfzilla/themes/bootflat/templates/homepage/home.html @@ -1,3 +1,50 @@ {% extends '_layout.html'|pjax:request %} +{% load i18n thumbnail %} -{% block content %}asd{% endblock %} +{% block main_content %} +
+ {{ volume.publisher }}
+ {{ volume.release_date }}
+