Make club app a little more manageable.
[wolnelektury.git] / src / api / urls.py
1 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
3 #
4 from django.conf.urls import url, include
5 from django.views.decorators.csrf import csrf_exempt
6 from django.views.generic import TemplateView
7 import catalogue.views
8 from stats.utils import piwik_track_view
9 from . import views
10
11
12 urlpatterns = [
13     url(r'^oauth/request_token/$', csrf_exempt(views.OAuth1RequestTokenView.as_view())),
14     url(r'^oauth/authorize/$', views.oauth_user_auth, name='oauth_user_auth'),
15     url(r'^oauth/access_token/$', csrf_exempt(views.OAuth1AccessTokenView.as_view())),
16
17     url(r'^$', TemplateView.as_view(template_name='api/main.html'), name='api'),
18
19     # info boxes (used by mobile app)
20     url(r'book/(?P<book_id>\d*?)/info\.html$', catalogue.views.book_info),
21     url(r'tag/(?P<tag_id>\d*?)/info\.html$', catalogue.views.tag_info),
22
23     # reading data
24     url(r'^reading/(?P<slug>[a-z0-9-]+)/$',
25         piwik_track_view(views.BookUserDataView.as_view()),
26         name='api_reading'),
27     url(r'^reading/(?P<slug>[a-z0-9-]+)/(?P<state>[a-z]+)/$',
28         piwik_track_view(views.BookUserDataView.as_view()),
29         name='api_reading'),
30     url(r'^username/$',
31         piwik_track_view(views.UserView.as_view()),
32         name='api_username'),
33
34     url(r'^blog$',
35         piwik_track_view(views.BlogView.as_view())),
36
37     url(r'^pictures/', include('picture.api.urls')),
38     url(r'^', include('social.api.urls')),
39     url(r'^', include('catalogue.api.urls')),
40 ]