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