fargo/fargo/urls.py

60 lines
2.5 KiB
Python

# fargo - document box
# Copyright (C) 2016-2019 Entr'ouvert
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from .fargo.views import (home, jsonp, json, document, download, pick, delete, upload, edit,
remote_download, login, logout, pick_list, document_types, thumbnail)
from .fargo.api_views import (push_document, recent_documents, router)
urlpatterns = [
url(r'^$', home, name='home'),
url(r'^pick/$', pick_list, name='list_to_pick'),
url(r'^jsonp/$', jsonp, name='jsonp'),
url(r'^json/$', json, name='json'),
url(r'^(?P<pk>\d+)/$', document, name='document'),
url(r'^(?P<pk>\d+)/edit/$', edit, name='edit'),
url(r'^(?P<pk>\d+)/delete/$', delete, name='delete'),
url(r'^(?P<pk>\d+)/pick/$', pick, name='pick'),
url(r'^(?P<pk>\d+)/download/(?P<filename>[^/]*)$', download,
name='download'),
url(r'^(?P<pk>\d+)/thumbnail/(?P<filename>[^/]*)$', thumbnail,
name='thumbnail'),
url(r'^upload/$', upload, name='upload'),
url(r'^remote-download/(?P<filename>[^/]*)$', remote_download,
name='remote_download'),
url(r'^admin/', include(admin.site.urls)),
url(r'^login/$', login, name='auth_login'),
url(r'^logout/$', logout, name='auth_logout'),
url(r'^document-types/$', document_types, name='document_types'),
url(r'^api/documents/push/$', push_document, name='fargo-api-push-document'),
url(r'^api/documents/recently-added/$', recent_documents),
url(r'^api/', include(router.urls)),
url(r'^api/', include('fargo.oauth2.urls')),
]
if settings.DEBUG and 'debug_toolbar' in settings.INSTALLED_APPS:
import debug_toolbar
urlpatterns = [
url(r'^__debug__/', include(debug_toolbar.urls)),
] + urlpatterns
if 'mellon' in settings.INSTALLED_APPS:
urlpatterns.append(url(r'^accounts/mellon/', include('mellon.urls')))