efcfe95ee5dac99c25432bb2a616ca14175fe620
[wolnelektury.git] / apps / pdcounter / views.py
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.
4 #
5 #from datetime import datetime
6
7 from django.template import RequestContext
8 from django.shortcuts import render_to_response, get_object_or_404
9 from pdcounter import models
10 from catalogue import forms
11 from suggest.forms import PublishingSuggestForm
12
13
14 def book_stub_detail(request, slug):
15     book = get_object_or_404(models.BookStub, slug=slug)
16     pd_counter = book.pd
17     form = forms.SearchForm()
18
19     pubsuggest_form = PublishingSuggestForm(
20             initial={"books": u"%s — %s, \n" % (book.author, book.title)})
21
22     return render_to_response('pdcounter/book_stub_detail.html', locals(),
23         context_instance=RequestContext(request))
24
25
26 def author_detail(request, slug):
27     author = get_object_or_404(models.Author, slug=slug)
28     pd_counter = author.goes_to_pd()
29     form = forms.SearchForm()
30
31     pubsuggest_form = PublishingSuggestForm(initial={"books": author.name + ", \n"})
32
33     return render_to_response('pdcounter/author_detail.html', locals(),
34         context_instance=RequestContext(request))