1 # chloro - personal space
2 # Copyright (C) 2019 Frederic Peters
4 # This program is free software: you can redistribute it and/or modify it
5 # under the terms of the GNU Affero General Public License as published
6 # by the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU Affero General Public License for more details.
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 from functools import partial
19 import ckeditor.views as ckeditor_views
20 from django.contrib.admin.views.decorators import staff_member_required
21 from django.urls import path, re_path
22 from django.views.decorators.cache import never_cache
26 staff_required = partial(staff_member_required, login_url='login')
32 staff_required(ckeditor_views.upload),
33 name='ckeditor_upload',
37 never_cache(staff_required(ckeditor_views.browse)),
38 name='ckeditor_browse',
40 re_path(r'^(?P<slug>[\w:-]+)/edit/$', staff_required(views.NoteEditView.as_view())),
42 r'^(?P<slug>[\w:-]+)/delete/$',
43 staff_required(views.NoteDeleteView.as_view()),
45 re_path(r'^(?P<slug>[\w:-]+)/api-save/$', staff_required(views.NoteApiSaveView.as_view())),
46 path('ajax/upload/', staff_required(views.ajax_upload)),
47 path('ajax/newpage/', staff_required(views.ajax_new_page)),
48 path('ajax/search/', views.ajax_search, name='ajax-search'),
49 path('new-note/', staff_required(views.NoteAddView.as_view())),
50 re_path(r'^feeds/(?P<sub>[\w:-]+)/atom$', views.AtomFeed()),
51 path('feed/atom', views.AtomFeed()),
52 re_path(r'^tag/(?P<tag>[\w:-]+)/$', views.ListOnTagView.as_view()),
53 path('archives/', views.ArchivesView.as_view()),
55 r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[\w:-]+)/$', views.NoteView.as_view()
57 re_path(r'^(?P<slug>[\w:-]+)/$', views.NoteView.as_view()),
58 path('', views.HomeView.as_view()),