1 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
4 from django.conf.urls import url
5 from django.db.models import Max
6 from django.views.generic import ListView, RedirectView
7 from catalogue.feeds import AudiobookFeed
8 from catalogue.models import Book
9 from catalogue import views
16 url(r'^obraz/strona/$', picture.views.picture_page, name='picture_page'),
17 # pictures - currently pictures are coupled with catalogue, hence the url is here
18 url(r'^obraz/$', picture.views.picture_list_thumb, name='picture_list_thumb'),
19 url(r'^obraz/(?P<slug>%s).html$' % SLUG, picture.views.picture_viewer, name='picture_viewer'),
20 url(r'^obraz/(?P<slug>%s)/$' % SLUG, picture.views.picture_detail, name='picture_detail'),
22 # old search page - redirected
23 url(r'^szukaj/$', RedirectView.as_view(
24 url='/szukaj/', query_string=True, permanent=True)),
26 url(r'^$', views.catalogue, name='catalogue'),
28 url(r'^autor/$', views.tag_catalogue, {'category': 'author'}, name='author_catalogue'),
29 url(r'^epoka/$', views.tag_catalogue, {'category': 'epoch'}, name='epoch_catalogue'),
30 url(r'^gatunek/$', views.tag_catalogue, {'category': 'genre'}, name='genre_catalogue'),
31 url(r'^rodzaj/$', views.tag_catalogue, {'category': 'kind'}, name='kind_catalogue'),
32 url(r'^motyw/$', views.tag_catalogue, {'category': 'theme'}, name='theme_catalogue'),
34 url(r'^galeria/$', views.gallery, name='gallery'),
35 url(r'^kolekcje/$', views.collections, name='catalogue_collections'),
37 url(r'^lektury/$', views.literature, name='book_list'),
38 url(r'^lektury/(?P<slug>[a-zA-Z0-9-]+)/$', views.collection, name='collection'),
39 url(r'^audiobooki/$', views.audiobooks, name='audiobook_list'),
40 url(r'^daisy/$', views.daisy_list, name='daisy_list'),
41 url(r'^nowe/$', ListView.as_view(
42 queryset=Book.objects.filter(parent=None).order_by('-created_at'),
43 template_name='catalogue/recent_list.html'), name='recent_list'),
44 url(r'^nowe/audiobooki/$', ListView.as_view(
45 queryset=Book.objects.filter(media__type='ogg').annotate(m=Max('media__uploaded_at')).order_by('-m'),
46 template_name='catalogue/recent_audiobooks_list.html'), name='recent_audiobooks_list'),
47 url(r'^nowe/daisy/$', ListView.as_view(
48 queryset=Book.objects.filter(media__type='daisy').annotate(m=Max('media__uploaded_at')).order_by('-m'),
49 template_name='catalogue/recent_daisy_list.html'), name='recent_daisy_list'),
51 url(r'^custompdf/(?P<slug>%s)/$' % SLUG, views.CustomPDFFormView(), name='custom_pdf_form'),
53 url(r'^audiobooki/(?P<type>mp3|ogg|daisy|all).xml$', AudiobookFeed(), name='audiobook_feed'),
55 url(r'^pobierz/(?P<key>.*)/(?P<slug>%s).(?P<format_>[a-z0-9]*)$' % SLUG, views.embargo_link, name='embargo_link'),
58 url(r'^zip/pdf\.zip$', views.download_zip, {'format': 'pdf', 'slug': None}, 'download_zip_pdf'),
59 url(r'^zip/epub\.zip$', views.download_zip, {'format': 'epub', 'slug': None}, 'download_zip_epub'),
60 url(r'^zip/mobi\.zip$', views.download_zip, {'format': 'mobi', 'slug': None}, 'download_zip_mobi'),
61 url(r'^zip/mp3/(?P<slug>%s)\.zip' % SLUG, views.download_zip, {'format': 'mp3'}, 'download_zip_mp3'),
62 url(r'^zip/ogg/(?P<slug>%s)\.zip' % SLUG, views.download_zip, {'format': 'ogg'}, 'download_zip_ogg'),
64 # Public interface. Do not change this URLs.
65 url(r'^lektura/(?P<slug>%s)\.html$' % SLUG, views.book_text, name='book_text'),
66 url(r'^lektura/(?P<slug>%s)/audiobook/$' % SLUG, views.player, name='book_player'),
67 url(r'^lektura/(?P<slug>%s)/$' % SLUG, views.book_detail, name='book_detail'),
68 url(r'^lektura/(?P<slug>%s)/motyw/(?P<theme_slug>[a-zA-Z0-9-]+)/$' % SLUG,
69 views.book_fragments, name='book_fragments'),
71 url(r'^okladka-ridero/(?P<slug>%s).png$' % SLUG, views.ridero_cover),
72 url(r'^isbn/(?P<book_format>(pdf|epub|mobi|txt|html))/(?P<slug>%s)/' % SLUG, views.get_isbn),
74 # This should be the last pattern.
75 url(r'^galeria/(?P<tags>[a-zA-Z0-9-/]*)/$', views.tagged_object_list, {'list_type': 'gallery'},
76 name='tagged_object_list_gallery'),
77 url(r'^audiobooki/(?P<tags>[a-zA-Z0-9-/]*)/$', views.tagged_object_list, {'list_type': 'audiobooks'},
78 name='tagged_object_list_audiobooks'),
79 url(r'^(?P<tags>[a-zA-Z0-9-/]*)/$', views.tagged_object_list, {'list_type': 'books'},
80 name='tagged_object_list'),