X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/32cf6526ef36a9aa0af0de8673f19a94cbf5409b..f9a071b288cec64a55000125a63b62a3b233c3fd:/src/catalogue/api/urls.py diff --git a/src/catalogue/api/urls.py b/src/catalogue/api/urls.py index d70338a53..4e0d937c1 100644 --- a/src/catalogue/api/urls.py +++ b/src/catalogue/api/urls.py @@ -1,8 +1,7 @@ -# -*- coding: utf-8 -*- # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # -from django.conf.urls import include, url +from django.urls import path, re_path from stats.utils import piwik_track_view from . import views @@ -13,67 +12,67 @@ paginate_re = r'(?:after/(?P[a-z0-9-]+)/)?(?:count/(?P[0-9]+)/)?$' urlpatterns = [ # books by collections - url(r'^collections/$', - piwik_track_view(views.CollectionList.as_view()), - name="catalogue_api_collections"), - url(r'^collections/(?P[^/]+)/$', - piwik_track_view(views.CollectionDetail.as_view()), - name="collection-detail"), + path('collections/', + piwik_track_view(views.CollectionList.as_view()), + name="catalogue_api_collections"), + path('collections//', + piwik_track_view(views.CollectionDetail.as_view()), + name="collection-detail"), - url(tags_re + r'books/' + paginate_re, - piwik_track_view(views.BookList.as_view()), - name='catalogue_api_book_list'), - url(tags_re + r'parent_books/' + paginate_re, - piwik_track_view(views.BookList.as_view()), - {"top_level": True}, name='catalogue_api_parent_book_list'), - url(tags_re + r'audiobooks/' + paginate_re, - piwik_track_view(views.BookList.as_view()), - {"audiobooks": True}, name='catalogue_api_audiobook_list'), - url(tags_re + r'daisy/' + paginate_re, - piwik_track_view(views.BookList.as_view()), - {"daisy": True}, name='catalogue_api_daisy_list'), - url(r'^recommended/' + paginate_re, - piwik_track_view(views.BookList.as_view()), - {"recommended": True}, name='catalogue_api_recommended_list'), - url(r'^newest/$', - piwik_track_view(views.BookList.as_view()), - {"newest": True, "top_level": True, "count": 20}, - name='catalogue_api_newest_list'), + re_path(tags_re + r'books/' + paginate_re, + piwik_track_view(views.BookList.as_view()), + {"filename": "books"}, name='catalogue_api_book_list'), + re_path(tags_re + r'parent_books/' + paginate_re, + piwik_track_view(views.BookList.as_view()), + {"filename": "parent_books", "top_level": True}, name='catalogue_api_parent_book_list'), + re_path(tags_re + r'audiobooks/' + paginate_re, + piwik_track_view(views.BookList.as_view()), + {"filename": "audiobooks", "audiobooks": True}, name='catalogue_api_audiobook_list'), + re_path(tags_re + r'daisy/' + paginate_re, + piwik_track_view(views.BookList.as_view()), + {"filename": "daisy", "daisy": True}, name='catalogue_api_daisy_list'), + re_path(r'^recommended/' + paginate_re, + piwik_track_view(views.BookList.as_view()), + {"recommended": True}, name='catalogue_api_recommended_list'), + path('newest/', + piwik_track_view(views.BookList.as_view()), + {"newest": True, "top_level": True, "count": 20}, + name='catalogue_api_newest_list'), - url(r'^books/(?P[^/]+)/$', - piwik_track_view(views.BookDetail.as_view()), - name='catalogue_api_book'), + path('books//', + piwik_track_view(views.BookDetail.as_view()), + name='catalogue_api_book'), - url(tags_re + r'ebooks/' + paginate_re, - piwik_track_view(views.EbookList.as_view()), - name='catalogue_api_ebook_list'), - url(tags_re + r'parent_ebooks/' + paginate_re, - piwik_track_view(views.EbookList.as_view()), - {"top_level": True}, - name='catalogue_api_parent_ebook_list'), + re_path(tags_re + r'ebooks/' + paginate_re, + piwik_track_view(views.EbookList.as_view()), + name='catalogue_api_ebook_list'), + re_path(tags_re + r'parent_ebooks/' + paginate_re, + piwik_track_view(views.EbookList.as_view()), + {"top_level": True}, + name='catalogue_api_parent_ebook_list'), - url(r'^filter-books/$', - piwik_track_view(views.FilterBookList.as_view()), - name='catalogue_api_filter_books'), + path('filter-books/', + piwik_track_view(views.FilterBookList.as_view()), + name='catalogue_api_filter_books'), - url(r'^epub/(?P[a-z0-9-]+)/$', - piwik_track_view(views.EpubView.as_view()), - name='catalogue_api_epub'), + path('epub//', + piwik_track_view(views.EpubView.as_view()), + name='catalogue_api_epub'), - url(r'^preview/$', - piwik_track_view(views.Preview.as_view()), - name='catalogue_api_preview'), + path('preview/', + piwik_track_view(views.Preview.as_view()), + name='catalogue_api_preview'), - url(r'^(?P(?:(?:[a-z0-9-]+/){2}){1,6})fragments/$', - piwik_track_view(views.FragmentList.as_view())), - url(r'^books/(?P[a-z0-9-]+)/fragments/(?P[a-z0-9-]+)/$', - piwik_track_view(views.FragmentView.as_view()), - name="catalogue_api_fragment"), + re_path(r'^(?P(?:(?:[a-z0-9-]+/){2}){1,6})fragments/$', + piwik_track_view(views.FragmentList.as_view())), + path('books//fragments//', + piwik_track_view(views.FragmentView.as_view()), + name="catalogue_api_fragment"), - url(r'^(?P[a-z]+)s/$', - piwik_track_view(views.TagCategoryView.as_view()), - name='catalogue_api_tag_list'), - url(r'^(?P[a-z]+)s/(?P[a-z0-9-]+)/$', - piwik_track_view(views.TagView.as_view()), - name="catalogue_api_tag"), + path('s/', + piwik_track_view(views.TagCategoryView.as_view()), + name='catalogue_api_tag_list'), + path('s//', + piwik_track_view(views.TagView.as_view()), + name="catalogue_api_tag"), ]