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.urls import path from webapp.views import TaskIndexView, TaskView, TaskCreateView, DeleteView, TaskUpdateView,\ ProjectIndexView, ProjectView, ProjectCreateView, ProjectTaskCreateView urlpatterns = [ path('admin/', admin.site.urls), path('', TaskIndexView.as_view(), name='index'), path('task/<int:pk>/', TaskView.as_view(), name='view'), path('task/add/', TaskCreateView.as_view(), name='create'), path('task/<int:pk>/delete', DeleteView.as_view(), name='delete'), path('task/<int:pk>/update', TaskUpdateView.as_view(), name='update'), path('projects/', ProjectIndexView.as_view(), name='project_index'), path('project/<int:pk>/', ProjectView.as_view(), name='project_view'), path('project/add', ProjectCreateView.as_view(), name='project_create'), path('project/<int:pk>/task/add/', ProjectTaskCreateView.as_view(), name='create_task_project') ]
from django.urls import path from webapp.views import (IndexView, TracerView, TracerDeleteView, TracerUpdateView, ProjectTracerCreate, ProjectCreateView, ProjectIndexView, ProjectView, ProjectDeleteView, ProjectUpdateView, UserUpdateView) app_name = 'project' urlpatterns = [ path('tracers/', IndexView.as_view(), name='list'), path('<int:pk>/', TracerView.as_view(), name='view'), path('<int:pk>/update/', TracerUpdateView.as_view(), name='update'), path('<int:pk>/delete/', TracerDeleteView.as_view(), name='delete'), path('user/<int:pk>', UserUpdateView.as_view(), name="user_update"), path('project/add/', ProjectCreateView.as_view(), name='project_add'), path('project_tracer/<int:pk>/add/', ProjectTracerCreate.as_view(), name='project_tracer_add'), path('', ProjectIndexView.as_view(), name='project_list'), path('project/<int:pk>/', ProjectView.as_view(), name='project_view'), path('project/<int:pk>/update/', ProjectUpdateView.as_view(), name='project_update'), path('project/<int:pk>/delete/', ProjectDeleteView.as_view(), name='project_delete'), ]
path('status/<int:pk>/', StatusView.as_view(), name='status_view'), path('status/add/', StatusCreateView.as_view(), name='status_add'), path('status/<int:pk>/update/', StatusUpdateView.as_view(), name='status_update'), path('status/<int:pk>/delete/', StatusDeleteView.as_view(), name='status_delete'), path('type/', TypeIndexView.as_view(), name='type'), path('type/<int:pk>/', TypeView.as_view(), name='type_view'), path('type/add/', TypeCreateView.as_view(), name='type_add'), path('type/<int:pk>/update/', TypeUpdateView.as_view(), name='type_update'), path('type/<int:pk>/delete/', TypeDeleteView.as_view(), name='type_delete'), path('project/', ProjectIndexView.as_view(), name='project'), path('project/<int:pk>/', ProjectView.as_view(), name='project_view'), path('project/<int:pk>/delete/', ProjectDeleteView.as_view(), name='project_delete'), path('project/add/', ProjectCreateView.as_view(), name='project_add'), path('project/<int:pk>/update/', ProjectUpdateView.as_view(), name='project_update'), path('project/<int:pk>/users/update/', TeamProjectUserUpdate.as_view(), name='project_users_update'), path('project/user/<int:pk>/delete', TeamUserDelete.as_view(), name='team_delete') ]