2019-06-27 06:09:51 +00:00
|
|
|
"""siteroot URL Configuration
|
|
|
|
|
|
|
|
The `urlpatterns` list routes URLs to views. For more information please see:
|
|
|
|
https://docs.djangoproject.com/en/2.2/topics/http/urls/
|
|
|
|
Examples:
|
|
|
|
Function views
|
|
|
|
1. Add an import: from my_app import views
|
|
|
|
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
|
|
|
Class-based views
|
|
|
|
1. Add an import: from other_app.views import Home
|
|
|
|
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
|
|
|
Including another URLconf
|
|
|
|
1. Import the include() function: from django.urls import include, path
|
|
|
|
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
|
|
|
"""
|
2024-01-27 10:29:16 +00:00
|
|
|
|
2022-08-07 10:41:11 +00:00
|
|
|
from django.conf import settings
|
2019-07-02 07:34:12 +00:00
|
|
|
from django.contrib.auth import views as auth_views
|
2019-06-27 06:09:51 +00:00
|
|
|
from django.urls import path, include
|
2021-02-24 02:36:27 +00:00
|
|
|
|
|
|
|
from bookmarks.admin import linkding_admin_site
|
2024-03-16 22:42:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
class LinkdingLoginView(auth_views.LoginView):
|
|
|
|
"""
|
|
|
|
Custom login view to lazily add additional context data
|
|
|
|
Allows to override settings in tests
|
|
|
|
"""
|
|
|
|
|
|
|
|
def get_context_data(self, **kwargs):
|
|
|
|
context = super().get_context_data(**kwargs)
|
|
|
|
|
|
|
|
context["allow_registration"] = settings.ALLOW_REGISTRATION
|
|
|
|
context["enable_oidc"] = settings.LD_ENABLE_OIDC
|
|
|
|
return context
|
|
|
|
|
2019-06-27 06:09:51 +00:00
|
|
|
|
|
|
|
urlpatterns = [
|
2024-01-27 10:29:16 +00:00
|
|
|
path("admin/", linkding_admin_site.urls),
|
|
|
|
path(
|
|
|
|
"login/",
|
2024-03-16 22:42:46 +00:00
|
|
|
LinkdingLoginView.as_view(redirect_authenticated_user=True),
|
2024-01-27 10:29:16 +00:00
|
|
|
name="login",
|
|
|
|
),
|
|
|
|
path("logout/", auth_views.LogoutView.as_view(), name="logout"),
|
|
|
|
path(
|
|
|
|
"change-password/",
|
|
|
|
auth_views.PasswordChangeView.as_view(),
|
|
|
|
name="change_password",
|
|
|
|
),
|
|
|
|
path(
|
|
|
|
"password-change-done/",
|
|
|
|
auth_views.PasswordChangeDoneView.as_view(),
|
|
|
|
name="password_change_done",
|
|
|
|
),
|
|
|
|
path("", include("bookmarks.urls")),
|
2019-06-27 06:09:51 +00:00
|
|
|
]
|
2019-12-24 12:31:55 +00:00
|
|
|
|
2024-03-16 22:42:46 +00:00
|
|
|
if settings.LD_ENABLE_OIDC:
|
|
|
|
urlpatterns.append(path("oidc/", include("mozilla_django_oidc.urls")))
|
|
|
|
|
2022-08-07 10:41:11 +00:00
|
|
|
if settings.LD_CONTEXT_PATH:
|
|
|
|
urlpatterns = [path(settings.LD_CONTEXT_PATH, include(urlpatterns))]
|
|
|
|
|
2024-03-16 22:42:46 +00:00
|
|
|
if settings.DEBUG:
|
2021-03-28 10:11:56 +00:00
|
|
|
import debug_toolbar
|
2021-10-16 03:42:04 +00:00
|
|
|
|
2024-01-27 10:29:16 +00:00
|
|
|
urlpatterns.append(path("__debug__/", include(debug_toolbar.urls)))
|
2021-03-28 10:11:56 +00:00
|
|
|
|
2024-03-16 22:42:46 +00:00
|
|
|
if settings.ALLOW_REGISTRATION:
|
2024-01-27 10:29:16 +00:00
|
|
|
urlpatterns.append(path("", include("django_registration.backends.one_step.urls")))
|