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