fix test
[wolnelektury.git] / apps / catalogue / urls.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 django.conf.urls.defaults import *
6 from catalogue.feeds import AudiobookFeed
7 from catalogue.views import CustomPDFFormView
8
9
10 SLUG = r'[a-z0-9-]*'
11
12 urlpatterns = patterns('picture.views',
13     # pictures - currently pictures are coupled with catalogue, hence the url is here
14     url(r'^obraz/?$', 'picture_list'),
15     url(r'^obraz/(?P<picture>%s)/?$' % SLUG, 'picture_detail')
16 )
17
18 # workaround for Django ticket #17111; redirect when resolved
19 urlpatterns += patterns('search.views',
20     url(r'^szukaj/$', 'main'),  
21 )
22 #urlpatterns += patterns('django.views.generic.simple',
23 #    # old search page - redirected
24 #    url(r'^szukaj/$', 'redirect_to',
25 #        
26 #        {'url': '/szukaj/', 'query_string': True}),  
27 #)
28
29 urlpatterns += patterns('catalogue.views',
30     url(r'^$', 'catalogue', name='catalogue'),
31
32     url(r'^lektury/$', 'book_list', name='book_list'),
33     url(r'^lektury/(?P<slug>[a-zA-Z0-9-]+)/$', 'collection', name='collection'),
34     url(r'^audiobooki/$', 'audiobook_list', name='audiobook_list'),
35     url(r'^daisy/$', 'daisy_list', name='daisy_list'),
36     url(r'^tags/$', 'tags_starting_with', name='hint'),
37     url(r'^jtags/$', 'json_tags_starting_with', name='jhint'),
38     #url(r'^szukaj/$', 'search', name='old_search'),
39
40     url(r'^custompdf/(?P<slug>%s)/$' % SLUG, CustomPDFFormView(), name='custom_pdf_form'),
41
42     url(r'^audiobooki/(?P<type>mp3|ogg|daisy|all).xml$', AudiobookFeed(), name='audiobook_feed'),
43
44
45     # zip
46     url(r'^zip/pdf\.zip$', 'download_zip', {'format': 'pdf', 'slug': None}, 'download_zip_pdf'),
47     url(r'^zip/epub\.zip$', 'download_zip', {'format': 'epub', 'slug': None}, 'download_zip_epub'),
48     url(r'^zip/mobi\.zip$', 'download_zip', {'format': 'mobi', 'slug': None}, 'download_zip_mobi'),
49     url(r'^zip/mp3/(?P<slug>%s)\.zip' % SLUG, 'download_zip', {'format': 'mp3'}, 'download_zip_mp3'),
50     url(r'^zip/ogg/(?P<slug>%s)\.zip' % SLUG, 'download_zip', {'format': 'ogg'}, 'download_zip_ogg'),
51
52     # Public interface. Do not change this URLs.
53     url(r'^lektura/(?P<slug>%s)\.html$' % SLUG, 'book_text', name='book_text'),
54     url(r'^lektura/(?P<slug>%s)/audiobook/$' % SLUG, 'player', name='book_player'),
55     url(r'^lektura/(?P<slug>%s)/$' % SLUG, 'book_detail', name='book_detail'),
56     url(r'^lektura/(?P<slug>%s)/motyw/(?P<theme_slug>[a-zA-Z0-9-]+)/$' % SLUG,
57         'book_fragments', name='book_fragments'),
58
59     # This should be the last pattern.
60     url(r'^(?P<tags>[a-zA-Z0-9-/]*)/$', 'tagged_object_list', name='tagged_object_list'),
61 )