from django.core.urlresolvers import reverse
from piston.handler import AnonymousBaseHandler, BaseHandler
from piston.utils import rc
+from sorl.thumbnail import default
from api.helpers import timestamp
from api.models import Deleted
def cover(cls, book):
return MEDIA_BASE + book.cover.url if book.cover else ''
+ @classmethod
+ def cover_thumb(cls, book):
+ return MEDIA_BASE + default.backend.get_thumbnail(
+ book.cover, "139x193").url if book.cover else ''
+
class BookDetailHandler(BaseHandler, BookDetails):
"""
allowed_methods = ['GET']
fields = ['title', 'parent', 'children'] + Book.formats + [
- 'media', 'url', 'cover'] + [
+ 'media', 'url', 'cover', 'cover_thumb'] + [
category_plural[c] for c in book_tag_categories]
@piwik_track
if top_level:
books = books.filter(parent=None)
if audiobooks:
- books = books.filter(media__type='mp3')
+ books = books.filter(media__type='mp3').distinct()
if daisy:
- books = books.filter(media__type='daisy')
+ books = books.filter(media__type='daisy').distinct()
if books.exists():
return books
return rc.NOT_FOUND
+class EBooksHandler(AnonymousBooksHandler):
+ fields = ('author', 'href', 'title', 'cover') + tuple(Book.ebook_formats)
+
+
# add categorized tags fields for Book
def _tags_getter(category):
@classmethod
changes_resource = Resource(handler=handlers.ChangesHandler)
book_list_resource = CsrfExemptResource(handler=handlers.BooksHandler, authentication=auth)
+ebook_list_resource = Resource(handler=handlers.EBooksHandler)
#book_list_resource = Resource(handler=handlers.BooksHandler)
book_resource = Resource(handler=handlers.BookDetailHandler)
# books by tags
url(r'^(?P<tags>(?:(?:[a-z0-9-]+/){2}){0,6})books/$',
book_list_resource, name='api_book_list'),
+ url(r'^(?P<tags>(?:(?:[a-z0-9-]+/){2}){0,6})ebooks/$',
+ ebook_list_resource, name='api_ebook_list'),
url(r'^(?P<tags>(?:(?:[a-z0-9-]+/){2}){0,6})parent_books/$',
book_list_resource, {"top_level": True}, name='api_parent_book_list'),
+ url(r'^(?P<tags>(?:(?:[a-z0-9-]+/){2}){0,6})parent_ebooks/$',
+ ebook_list_resource, {"top_level": True}, name='api_parent_ebook_list'),
url(r'^(?P<tags>(?:(?:[a-z0-9-]+/){2}){0,6})audiobooks/$',
book_list_resource, {"audiobooks": True}, name='api_audiobook_list'),
url(r'^(?P<tags>(?:(?:[a-z0-9-]+/){2}){0,6})daisy/$',
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-08-22 14:06+0200\n"
-"PO-Revision-Date: 2012-08-22 14:12+0100\n"
+"POT-Creation-Date: 2012-11-08 16:21+0100\n"
+"PO-Revision-Date: 2012-11-08 16:21+0100\n"
"Last-Translator: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
msgid "Queue is full. Please try again later."
msgstr ""
-#: views.py:500
+#: views.py:525
#, python-format
msgid ""
"An error occurred: %(exception)s\n"
"\n"
"%(tb)s"
-#: views.py:501
+#: views.py:526
msgid "Book imported successfully"
msgstr "Książka zaimportowana"
-#: views.py:503
+#: views.py:528
#, python-format
msgid "Error importing file: %r"
msgstr "Błąd podczas importowania pliku: %r"
-#: views.py:535
+#: views.py:560
msgid "Download custom PDF"
msgstr "Stwórz własny PDF"
-#: views.py:536
+#: views.py:561
#: templates/catalogue/book_short.html:92
#: templates/catalogue/book_text.html:28
#: templates/catalogue/book_wide.html:63
msgstr "Kod języka"
#: models/book.py:35
-#: models/book.py:140
+#: models/book.py:145
#: models/collection.py:13
#: models/tag.py:34
-#: models/tag.py:76
+#: models/tag.py:83
msgid "description"
msgstr "opis"
msgid "books"
msgstr "książki"
-#: models/book.py:238
+#: models/book.py:243
#, python-format
msgid "Book \"%s\" does not exist."
msgstr "Utwór \"%s\" nie istnieje."
-#: models/book.py:252
+#: models/book.py:257
#, python-format
msgid "Book %s already exists"
msgstr "Książka %s już istnieje"
-#: models/book.py:585
+#: models/book.py:589
#: models/bookmedia.py:22
#, python-format
msgid "%s file"
msgid "Table of Content"
msgstr ""
-#: templates/catalogue/book_list.html:48
+#: templates/catalogue/book_list.html:30
msgid "↑ top ↑"
msgstr ""
msgstr ""
#: templates/catalogue/book_text.html:24
-#: templates/catalogue/menu.html:27
+#: templatetags/catalogue_tags.py:412
#, fuzzy
msgid "Themes"
msgstr "motyw"
msgstr ""
#: templates/catalogue/catalogue.html:19
-#: templates/catalogue/menu.html:7
#: templates/catalogue/search_multiple_hits.html:17
#: templates/catalogue/tagged_object_list.html:26
+#: templatetags/catalogue_tags.py:408
#, fuzzy
msgid "Authors"
msgstr "autor"
#: templates/catalogue/catalogue.html:22
-#: templates/catalogue/menu.html:17
#: templates/catalogue/search_multiple_hits.html:25
#: templates/catalogue/tagged_object_list.html:34
+#: templatetags/catalogue_tags.py:410
msgid "Kinds"
msgstr ""
#: templates/catalogue/catalogue.html:25
-#: templates/catalogue/menu.html:12
#: templates/catalogue/search_multiple_hits.html:33
#: templates/catalogue/tagged_object_list.html:42
+#: templatetags/catalogue_tags.py:409
#, fuzzy
msgid "Genres"
msgstr "gatunek"
#: templates/catalogue/catalogue.html:28
-#: templates/catalogue/menu.html:22
#: templates/catalogue/search_multiple_hits.html:41
#: templates/catalogue/tagged_object_list.html:50
+#: templatetags/catalogue_tags.py:411
#, fuzzy
msgid "Epochs"
msgstr "epoka"
msgid "See full category"
msgstr "kategoria"
-#: templates/catalogue/menu.html:32
+#: templates/catalogue/menu.html:9
+msgid "Please wait…"
+msgstr ""
+
+#: templates/catalogue/menu.html:16
#, fuzzy
msgid "All books"
msgstr "książki"
-#: templates/catalogue/menu.html:36
+#: templates/catalogue/menu.html:20
#, fuzzy
msgid "Audiobooks"
msgstr "książki"
-#: templates/catalogue/menu.html:40
+#: templates/catalogue/menu.html:24
#, fuzzy
msgid "DAISY"
msgstr "Plik DAISY"
msgid "Did you mean"
msgstr ""
-#: templates/catalogue/search_multiple_hits.html:54
-msgid "Results by authors"
+#: templates/catalogue/search_multiple_hits.html:52
+msgid "Results by title"
msgstr ""
#: templates/catalogue/search_multiple_hits.html:67
-msgid "Results by title"
+msgid "Results by authors"
msgstr ""
-#: templates/catalogue/search_multiple_hits.html:82
+#: templates/catalogue/search_multiple_hits.html:80
+msgid "Results by translators"
+msgstr "Znalezieni tłumacze"
+
+#: templates/catalogue/search_multiple_hits.html:93
msgid "Results in text"
msgstr ""
-#: templates/catalogue/search_multiple_hits.html:99
+#: templates/catalogue/search_multiple_hits.html:110
msgid "Other results"
msgstr ""
#~ msgid "goes to public domain"
#~ msgstr "trafia do domeny publicznej"
-#~ msgid "translator"
-#~ msgstr "tłumacz"
-
#~ msgid "year of translator's death"
#~ msgstr "rok śmierci tłumacza"
self.assertEqual([(tag.name, tag.count) for tag in related_themes],
[('ChildTheme', 1), ('ParentTheme', 1), ('Theme', 2)])
- def test_main_page_tags(self):
+ def test_catalogue_tags(self):
""" test main page tags and counts """
- from catalogue.templatetags.catalogue_tags import catalogue_menu
- menu = catalogue_menu()
- self.assertEqual([(tag.name, tag.book_count) for tag in menu['author']],
+ context = self.client.get('/katalog/').context
+ self.assertEqual([(tag.name, tag.book_count) for tag in context['categories']['author']],
[('Jim Lazy', 1), ('Common Man', 1)])
- self.assertEqual([(tag.name, tag.book_count) for tag in menu['theme']],
+ self.assertEqual([(tag.name, tag.book_count) for tag in context['categories']['theme']],
[('ChildTheme', 1), ('ParentTheme', 1), ('Theme', 2)])
django-pipeline>=1.2
django-pagination>=1.0
django-maintenancemode>=0.10
-django-piston<=0.2.3
+django-piston==0.2.2
#django-jsonfield
-e git+git://github.com/bradjasper/django-jsonfield.git@2f427368ad70bf8d9a0580df58ec0eb0654d62ae#egg=django-jsonfield
django-picklefield