From 7fba1a212b01d66d9dd32aede74f06740c24662e Mon Sep 17 00:00:00 2001 From: eric Date: Wed, 5 Mar 2014 14:02:12 -0500 Subject: [PATCH] Give more prominence to CC books on landing page --- frontend/templates/home.html | 12 ++++++++++++ frontend/views.py | 8 +++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/frontend/templates/home.html b/frontend/templates/home.html index b82695f7..47bc9257 100755 --- a/frontend/templates/home.html +++ b/frontend/templates/home.html @@ -80,6 +80,18 @@ function put_un_in_cookie2(){ {% endfor %} +
+ +
+ {% for work in cc_books %} + {% with work.googlebooks_id as googlebooks_id %} + {% with "ACTIVE" as status %} + {% with work.last_campaign.deadline as deadline %} + {% include "book_panel.html" %} + {% endwith %}{% endwith %}{% endwith %} + {% endfor %} + +
diff --git a/frontend/views.py b/frontend/views.py index bb039c77..5ec1c5d1 100755 --- a/frontend/views.py +++ b/frontend/views.py @@ -228,6 +228,11 @@ def home(request, landing=False): most_wished = models.Work.objects.order_by('-num_wishes')[:4] unglued_books = models.Work.objects.filter(campaigns__status="SUCCESSFUL").order_by('-campaigns__deadline')[:4] + + cc_books = models.Work.objects.filter( + editions__ebooks__isnull=False, + editions__ebooks__rights__in=['CC BY', 'CC BY-NC-SA', 'CC BY-NC-ND', 'CC BY-NC', 'CC BY-ND', 'CC BY-SA'] + ).distinct().order_by('-created')[:4] """ get various recent types of site activity @@ -290,7 +295,8 @@ def home(request, landing=False): 'top_campaigns': top_campaigns, 'coming_soon': coming_soon, 'unglued_books': unglued_books, - 'most_wished': most_wished + 'cc_books': cc_books, + 'most_wished': most_wished, } )