diff --git a/frontend/templates/bypub_list.html b/frontend/templates/bypub_list.html new file mode 100644 index 00000000..27b88734 --- /dev/null +++ b/frontend/templates/bypub_list.html @@ -0,0 +1,138 @@ +{% extends "base.html" %} +{% load endless %} +{% load lang_utils %} + +{% block title %} Works published by {{ pubname }} {% endblock %} +{% block extra_css %} + + + + +{% endblock %} +{% block extra_head %} + + + + + + + +{% endblock %} +{% block topsection %} +
{{ activetab }}
+
+
+
+
+
+
+
+
+
{{ facet|capfirst }}
+
+
Books from {{ pubname }} {% if pub_lang %}( {{pub_lang|ez_lang_name}} ) {% endif %} +
+
+
+
+
+
+
+
+ +
+
+ +{% endblock %} +{% block content %} +
+
+
+ {% include "explore.html" %} +
+ +
+
+
+ +
+ {% ifequal work_list.count 0 %} + There aren't any {{ pub_lang|ez_lang_name }} works in this list yet. Why not add your favorite books to your wishlist, so we can feature them here? + {% else %} + {% lazy_paginate 20 works_unglued using "works_unglued" %} + {% for work in works_unglued %} +
+ {% with work.last_campaign_status as status %} + {% with work.last_campaign.deadline as deadline %} + {% with work.googlebooks_id as googlebooks_id %} + {% include "book_panel.html" %} + {% endwith %}{% endwith %}{% endwith %} +
+ {% endfor %} + + + {% lazy_paginate 20 works_active using "works_active" %} + {% for work in works_active %} +
+ {% with work.last_campaign_status as status %} + {% with work.last_campaign.deadline as deadline %} + {% with work.googlebooks_id as googlebooks_id %} + {% include "book_panel.html" %} + {% endwith %}{% endwith %}{% endwith %} +
+ {% endfor %} + + + {% lazy_paginate 20 works_wished using "works_wished" %} + {% for work in works_wished %} +
+ {% with work.last_campaign_status as status %} + {% with work.last_campaign.deadline as deadline %} + {% with work.googlebooks_id as googlebooks_id %} + {% include "book_panel.html" %} + {% endwith %}{% endwith %}{% endwith %} +
+ {% endfor %} + + {% endifequal %} +
+
+
+
+
+
+{% endblock %} diff --git a/frontend/templates/explore.html b/frontend/templates/explore.html index f46b1810..9382205a 100644 --- a/frontend/templates/explore.html +++ b/frontend/templates/explore.html @@ -20,6 +20,15 @@
  • Newly Wished
  • Noteworthy
  • Ready to Read
  • + {% if pubname %} +
  • {{ pubname }}... + +
  • + {% endif %} {% if show_langs %} diff --git a/frontend/templates/work.html b/frontend/templates/work.html index 22557c56..291e7d46 100644 --- a/frontend/templates/work.html +++ b/frontend/templates/work.html @@ -370,7 +370,7 @@ $j(document).ready(function(){ edition cover {% endif %} -
    {% if edition.publisher %}Publisher: {{edition.publisher}}
    {% endif %} +
    {% if edition.publisher %}Publisher: {{edition.publisher}}
    {% endif %} {% if edition.publication_date %}Published: {{edition.publication_date}}
    {% endif %} {% if edition.isbn_13 %} ISBN: {{ edition.isbn_13 }}
    diff --git a/frontend/urls.py b/frontend/urls.py index 7c799051..da2a1779 100644 --- a/frontend/urls.py +++ b/frontend/urls.py @@ -11,7 +11,7 @@ from regluit.core.feeds import SupporterWishlistFeed from regluit.core.models import Campaign from regluit.frontend.views import GoodreadsDisplayView, LibraryThingView, PledgeView, PledgeCompleteView, PledgeCancelView, PledgeRechargeView, FAQView from regluit.frontend.views import CampaignListView, WorkListView, UngluedListView, InfoPageView, InfoLangView, DonationView, FundPledgeView -from regluit.frontend.views import NonprofitCampaign, DonationCredit, PledgeModifiedView, ManageAccount, MergeView +from regluit.frontend.views import NonprofitCampaign, DonationCredit, PledgeModifiedView, ManageAccount, MergeView, ByPubListView urlpatterns = patterns( "regluit.frontend.views", @@ -37,6 +37,8 @@ urlpatterns = patterns( url(r"^wishlist/$", "wishlist", name="wishlist"), url(r"^campaigns/(?P\w*)$", CampaignListView.as_view(), name='campaign_list'), url(r"^lists/(?P\w*)$", WorkListView.as_view(), name='work_list'), + url(r"^bypub/(?P[^/]*)/(?P\w*)$", ByPubListView.as_view(), name='bypub_list'), + url(r"^bypub/(?P[^/]*)$", ByPubListView.as_view(), name='bypub_list'), url(r"^unglued/(?P\w*)$", UngluedListView.as_view(), name='unglued_list'), url(r"^goodreads/auth/$", "goodreads_auth", name="goodreads_auth"), url(r"^goodreads/auth_cb/$", "goodreads_cb", name="goodreads_cb"), diff --git a/frontend/views.py b/frontend/views.py index f7b23009..699b0d41 100755 --- a/frontend/views.py +++ b/frontend/views.py @@ -484,6 +484,7 @@ recommended_user = User.objects.filter( username=settings.UNGLUEIT_RECOMMENDED_U class WorkListView(FilterableListView): template_name = "work_list.html" context_object_name = "work_list" + max_works=20 def get_queryset_all(self): facet = self.kwargs['facet'] @@ -500,11 +501,11 @@ class WorkListView(FilterableListView): context = super(WorkListView, self).get_context_data(**kwargs) qs=self.get_queryset() context['ungluers'] = userlists.work_list_users(qs,5) - context['facet'] = self.kwargs['facet'] + context['facet'] = self.kwargs.get('facet','') works_unglued = qs.filter(editions__ebooks__isnull=False).distinct() | qs.filter(campaigns__status='SUCCESSFUL').distinct() - context['works_unglued'] = works_unglued.order_by('-campaigns__status', 'campaigns__deadline', '-num_wishes')[:20] - context['works_active'] = qs.filter(campaigns__status='ACTIVE').distinct()[:20] - context['works_wished'] = qs.exclude(editions__ebooks__isnull=False).exclude(campaigns__status='ACTIVE').exclude(campaigns__status='SUCCESSFUL').distinct()[:20] + context['works_unglued'] = works_unglued.order_by('-campaigns__status', 'campaigns__deadline', '-num_wishes')[:self.max_works] + context['works_active'] = qs.filter(campaigns__status='ACTIVE').distinct()[:self.max_works] + context['works_wished'] = qs.exclude(editions__ebooks__isnull=False).exclude(campaigns__status='ACTIVE').exclude(campaigns__status='SUCCESSFUL').distinct()[:self.max_works] context['activetab'] = "#3" @@ -516,6 +517,29 @@ class WorkListView(FilterableListView): return context +class ByPubListView(WorkListView): + template_name = "bypub_list.html" + context_object_name = "work_list" + max_works=100 + + def get_queryset_all(self): + facet = self.kwargs.get('facet','') + pubname = self.kwargs['pubname'] + objects = models.Work.objects.filter(editions__publisher__iexact=pubname).distinct() + if (facet == 'popular'): + return objects.order_by('-num_wishes', 'id') + elif (facet == 'pubdate'): + return objects.order_by('-editions__publication_date') + elif (facet == 'new'): + return objects.filter(num_wishes__gt=0).order_by('-created', '-num_wishes' ,'id') + else: + return objects.order_by('title', 'id') + + def get_context_data(self, **kwargs): + context = super(ByPubListView, self).get_context_data(**kwargs) + context['pubname'] = self.kwargs['pubname'] + return context + class UngluedListView(FilterableListView): template_name = "unglued_list.html" context_object_name = "work_list"