mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-17 10:13:56 -05:00
Make redirections respect root_path or STATIC_URL, name IndexView
This commit is contained in:
parent
e792a00feb
commit
56c9b578e3
@ -9,6 +9,8 @@ from rest_framework.routers import DefaultRouter
|
|||||||
|
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
from paperless.consumers import StatusConsumer
|
from paperless.consumers import StatusConsumer
|
||||||
from documents.views import (
|
from documents.views import (
|
||||||
CorrespondentViewSet,
|
CorrespondentViewSet,
|
||||||
@ -73,31 +75,36 @@ urlpatterns = [
|
|||||||
re_path(r"^fetch/", include([
|
re_path(r"^fetch/", include([
|
||||||
re_path(
|
re_path(
|
||||||
r"^doc/(?P<pk>\d+)$",
|
r"^doc/(?P<pk>\d+)$",
|
||||||
RedirectView.as_view(url='/api/documents/%(pk)s/download/'),
|
RedirectView.as_view(url=settings.BASE_URL +
|
||||||
|
'api/documents/%(pk)s/download/'),
|
||||||
),
|
),
|
||||||
re_path(
|
re_path(
|
||||||
r"^thumb/(?P<pk>\d+)$",
|
r"^thumb/(?P<pk>\d+)$",
|
||||||
RedirectView.as_view(url='/api/documents/%(pk)s/thumb/'),
|
RedirectView.as_view(url=settings.BASE_URL +
|
||||||
|
'api/documents/%(pk)s/thumb/'),
|
||||||
),
|
),
|
||||||
re_path(
|
re_path(
|
||||||
r"^preview/(?P<pk>\d+)$",
|
r"^preview/(?P<pk>\d+)$",
|
||||||
RedirectView.as_view(url='/api/documents/%(pk)s/preview/'),
|
RedirectView.as_view(url=settings.BASE_URL +
|
||||||
|
'api/documents/%(pk)s/preview/'),
|
||||||
),
|
),
|
||||||
])),
|
])),
|
||||||
|
|
||||||
re_path(r"^push$", csrf_exempt(
|
re_path(r"^push$", csrf_exempt(
|
||||||
RedirectView.as_view(url='/api/documents/post_document/'))),
|
RedirectView.as_view(url=settings.BASE_URL +
|
||||||
|
'api/documents/post_document/'))),
|
||||||
|
|
||||||
# Frontend assets TODO: this is pretty bad, but it works.
|
# Frontend assets TODO: this is pretty bad, but it works.
|
||||||
path('assets/<path:path>',
|
path('assets/<path:path>',
|
||||||
RedirectView.as_view(url='/static/frontend/en-US/assets/%(path)s')),
|
RedirectView.as_view(url=settings.STATIC_URL +
|
||||||
|
'frontend/en-US/assets/%(path)s')),
|
||||||
# TODO: with localization, this is even worse! :/
|
# TODO: with localization, this is even worse! :/
|
||||||
|
|
||||||
# login, logout
|
# login, logout
|
||||||
path('accounts/', include('django.contrib.auth.urls')),
|
path('accounts/', include('django.contrib.auth.urls')),
|
||||||
|
|
||||||
# Root of the Frontent
|
# Root of the Frontent
|
||||||
re_path(r".*", login_required(IndexView.as_view())),
|
re_path(r".*", login_required(IndexView.as_view()), name='base'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user