6188658cd946229e5edd17cf98690a3121466679
[wolnelektury.git] / src / wolnelektury / 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 include, url
5 from django.conf import settings
6 from django.contrib import admin
7 from django.views.generic import RedirectView
8 import django.views.static
9 import catalogue.views
10 import picture.views
11 from . import views
12
13
14 urlpatterns = [
15     url(r'^$', views.main_page, name='main_page'),
16     url(r'^planowane/$', views.publish_plan, name='publish_plan'),
17     url(r'^widget\.html$', views.widget, name='widget'),
18
19     url(r'^zegar/$', views.clock, name='clock'),
20
21     # Authentication
22     url(r'^uzytkownik/$', views.user_settings, name='user_settings'),
23     url(r'^uzytkownik/login/$', views.LoginFormView(), name='login'),
24     url(r'^uzytkownik/signup/$', views.RegisterFormView(), name='register'),
25     url(r'^uzytkownik/logout/$', views.logout_then_redirect, name='logout'),
26     url(r'^uzytkownik/zaloguj-utworz/$', views.LoginRegisterFormView(), name='login_register'),
27     url(r'^uzytkownik/social/signup/$', views.SocialSignupView.as_view(), name='socialaccount_signup'),
28 ]
29
30 urlpatterns += [
31     url(r'^katalog/', include('catalogue.urls')),
32     url(r'^opds/', include('opds.urls')),
33     url(r'^sugestia/', include('suggest.urls')),
34     url(r'^lesmianator/', include('lesmianator.urls')),
35     url(r'^przypisy/', include('dictionary.urls')),
36     url(r'^raporty/', include('reporting.urls')),
37     url(r'^info/', include('infopages.urls')),
38     url(r'^ludzie/', include('social.urls')),
39     url(r'^uzytkownik/', include('allauth.urls')),
40     url(r'^czekaj/', include('waiter.urls')),
41     url(r'^wesprzyj/', include('funding.urls')),
42     url(r'^ankieta/', include('polls.urls')),
43     url(r'^biblioteki/', include('libraries.urls')),
44     url(r'^newsletter/', include('newsletter.urls')),
45     url(r'^formularz/', include('forms_builder.forms.urls')),
46     url(r'^isbn/', include('isbn.urls')),
47
48     url(r'^paypal/app-form/$', RedirectView.as_view(
49         url='/towarzystwo/?app=1', permanent=False)),
50     url(r'^towarzystwo/dolacz/$', RedirectView.as_view(
51         url='/towarzystwo/', permanent=False)),
52
53
54     url(r'^paypal/', include('paypal.urls')),
55     url(r'^powiadomienie/', include('push.urls')),
56     url(r'^towarzystwo/', include('club.urls')),
57
58     # Admin panel
59     url(r'^admin/catalogue/book/import$', catalogue.views.import_book, name='import_book'),
60     url(r'^admin/catalogue/picture/import$', picture.views.import_picture, name='import_picture'),
61     url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
62     url(r'^admin/', admin.site.urls),
63
64     # API
65     url(r'^api/', include('api.urls')),
66     # OAIPMH
67     url(r'^oaipmh/', include('oai.urls')),
68
69     url(r'^szukaj/', include('search.urls')),
70
71     url(r'^i18n/', include('django.conf.urls.i18n')),
72     url(r'^forum/', include('machina.urls')),
73 ]
74
75 urlpatterns += [
76     # old static pages - redirected
77     url(r'^1procent/$', RedirectView.as_view(
78         url='http://nowoczesnapolska.org.pl/wesprzyj_nas/', permanent=True)),
79     url(r'^epub/$', RedirectView.as_view(
80         url='/katalog/lektury/', permanent=False)),
81     url(r'^mozesz-nam-pomoc/$', RedirectView.as_view(
82         url='/info/wlacz-sie-w-prace/', permanent=True)),
83     url(r'^o-projekcie/$', RedirectView.as_view(
84         url='/info/o-projekcie/', permanent=True)),
85     url(r'^widget/$', RedirectView.as_view(
86         url='/info/widget/', permanent=True)),
87     url(r'^wolontariat/$', RedirectView.as_view(
88         url='/info/wlacz-sie-w-prace/', permanent=False)),
89 ]
90
91 urlpatterns += [
92     url(r'^error-test/$', views.exception_test),
93     # url(r'^post-test/$', views.post_test),
94 ]
95
96
97 if settings.DEBUG:
98     import debug_toolbar
99     urlpatterns = [
100         url(r'^__debug__/', include(debug_toolbar.urls)),
101     ] + urlpatterns
102
103 if settings.DEBUG:
104     urlpatterns += [
105         # Static files
106         url(r'^%s(?P<path>.*)$' % settings.MEDIA_URL[1:], django.views.static.serve,
107            {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
108         url(r'^%s(?P<path>.*)$' % settings.STATIC_URL[1:], django.views.static.serve,
109             {'document_root': settings.STATIC_ROOT, 'show_indexes': True}),
110     ]