1 # -*- coding: utf-8 -*-
2 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 from datetime import datetime
6 from django.template import RequestContext
7 from django.shortcuts import render_to_response, get_object_or_404
8 from django.views.decorators import cache
9 from suggest.forms import PublishingSuggestForm
14 def book_stub_detail(request, slug):
15 book = get_object_or_404(models.BookStub, slug=slug)
16 if book.pd and not book.in_pd():
17 pd_counter = datetime(book.pd, 1, 1)
19 form = PublishingSuggestForm(initial={"books": u"%s — %s, \n" % (book.author, book.title)})
21 return render_to_response('pdcounter/book_stub_detail.html', locals(), context_instance=RequestContext(request))
25 def author_detail(request, slug):
26 author = get_object_or_404(models.Author, slug=slug)
27 if not author.alive():
28 pd_counter = datetime(author.goes_to_pd(), 1, 1)
30 form = PublishingSuggestForm(initial={"books": author.name + ", \n"})
32 return render_to_response('pdcounter/author_detail.html', locals(), context_instance=RequestContext(request))