Add ebookfile status and links to info page.

pull/1/head
eric 2014-02-25 14:47:16 -05:00
parent e72f55f919
commit ccafd90625
2 changed files with 26 additions and 0 deletions

View File

@ -98,6 +98,25 @@
</ul>
</dd>
</dl>
<h2>Ebook Files</h2>
<dd>
<ul class="terms">
<li>{{ ebookfiles.today.count }} have been added today. </li>
<li>{{ ebookfiles.yesterday.count }} were added yesterday.
</li>
<li>{{ ebookfiles.days7.count }} have been added in the past 7 days.{% if request.user.is_staff %}
<ul class="terms">{% for ebook_file in ebookfiles.days7 %}
<li>{{ebook_file.edition.work.title}}: <a href="{{ebook_file.file.url}}">{{ebook_file.file}}</a> created {{ebook_file.created}}</li>
{% endfor %}</ul>{% endif %}
</li>
<li>{{ ebookfiles.month.count }} have been added in this month.
</li>
<li>{{ ebookfiles.all.count }} have been added in total.
</li>
</ul>
</dd>
</dl>
<h2>Pledges</h2>
<dl>

View File

@ -2061,6 +2061,12 @@ class InfoPageView(TemplateView):
ebooks.year = ebooks.filter(created__year = date_today().year)
ebooks.month = ebooks.year.filter(created__month = date_today().month)
ebooks.yesterday = ebooks.filter(created__range = (date_today()-timedelta(days=1), date_today()))
ebookfiles = models.EbookFile.objects
ebookfiles.today = ebookfiles.filter(created__range = (date_today(), now()))
ebookfiles.days7 = ebookfiles.filter(created__range = (date_today()-timedelta(days=7), now()))
ebookfiles.year = ebookfiles.filter(created__year = date_today().year)
ebookfiles.month = ebookfiles.year.filter(created__month = date_today().month)
ebookfiles.yesterday = ebookfiles.filter(created__range = (date_today()-timedelta(days=1), date_today()))
wishlists= models.Wishlist.objects.exclude(wishes__isnull=True)
wishlists.today = wishlists.filter(created__range = (date_today(), now()))
wishlists.days7 = wishlists.filter(created__range = (date_today()-timedelta(days=7), now()))
@ -2088,6 +2094,7 @@ class InfoPageView(TemplateView):
'users': users,
'works': works,
'ebooks': ebooks,
'ebookfiles': ebookfiles,
'wishlists': wishlists,
'transactions': transactions,
}