loko/streetup/streetup/urls.py

64 lines
3.1 KiB
Python

"""
URL configuration for streetup project.
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/5.1/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'))
"""
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.urls import include, path, reverse_lazy
from django.conf import settings
from django.conf.urls.static import static
from django.conf.urls import handler403
from django.shortcuts import render
from django.views.i18n import JavaScriptCatalog, set_language
from django.contrib.auth.decorators import login_not_required
from common.private_files import views as private_files_views
urlpatterns = [
path("", include("home.urls")),
path("reporting/", include("reporting.urls_frontend")),
path("common/", include("common.urls")),
path("assets/", include("assets.urls")),
path("interventions/", include("interventions.urls")),
path("stock/", include("stock.urls")),
path("controls/", include("controls.urls")),
path("projects/", include("projects.urls")),
path("contracts/", include("contracts.urls")),
path("observations/", include("observations.urls")),
path("documents/", include("documents.urls")),
path("mobile/", include("mobile.urls")),
path("api/", include("api.urls")),
path("sign/", include("sign.urls")),
path("maps/", include("maps.urls")),
path("analytics/", include("analytics.urls")),
path("notifications/", include("notifications.urls")),
path("road-detection/", include("road_detection.urls")),
path("authorizations/", include("authorizations.urls")),
path("panoramax/", include("panoramax.urls")),
path('admin/', admin.site.urls),
path('accounts/login/', auth_views.LoginView.as_view(template_name='accounts/login.html', next_page='/'), name='login'),
path('accounts/logout/', auth_views.LogoutView.as_view(next_page='login'), name='logout'),
path("password/change/", auth_views.PasswordChangeView.as_view(success_url=reverse_lazy("common:account_info")), name="password_change",),
path('accounts/password_reset/', auth_views.PasswordResetView.as_view(), name='password_reset'),
path("private/download/", private_files_views.private_file_download, name="private_file_download"),
path("i18n/setlang/", login_not_required(set_language), name="set_language"),
path("jsi18n/", login_not_required(JavaScriptCatalog.as_view()), name="javascript-catalog"),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
def custom_403_view(request, exception):
return render(request, "403.html", status=403)
handler403 = custom_403_view