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