https://docs.djangoproject.com/en/3.0/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.urls import include, path from mysite import views from django.conf import settings from django.conf.urls.static import static from django.contrib.staticfiles.urls import staticfiles_urlpatterns from accounts.views import AccountMList from accounts.views import AccountsListView urlpatterns = [ path('', views.login_redirect, name='login_redirect'), path('accounts/', include('accounts.urls')), path('polls/', include('polls.urls')), path('admin/', admin.site.urls), path('accountm/', AccountMList.as_view()), path('accountschart/', AccountsListView.as_view()) ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) urlpatterns += staticfiles_urlpatterns()
AccountUpdateView, AccountDeleteView, AddCommentView, UpdateCommentView, DeleteCommentView, AddAttachmentView, DeleteAttachmentsView, create_mail, # get_account_details, get_contacts_for_account, get_email_data_for_account, get_teams_and_users) app_name = 'accounts' urlpatterns = [ path('', AccountsListView.as_view(), name='list'), path('create/', CreateAccountView.as_view(), name='new_account'), path('<int:pk>/view/', AccountDetailView.as_view(), name="view_account"), path('<int:pk>/edit/', AccountUpdateView.as_view(), name="edit_account"), path('<int:pk>/delete/', AccountDeleteView.as_view(), name="remove_account"), path('delete/', AccountDeleteView.as_view(), name="remove_account"), path('comment/add/', AddCommentView.as_view(), name="add_comment"), path('comment/edit/', UpdateCommentView.as_view(), name="edit_comment"), path('comment/remove/', DeleteCommentView.as_view(), name="remove_comment"), path('attachment/add/', AddAttachmentView.as_view(), name="add_attachment"), path('attachment/remove/', DeleteAttachmentsView.as_view(),
AccountDeleteView, AddCommentView, UpdateCommentView, DeleteCommentView, AddAttachmentView, DeleteAttachmentsView, create_mail, # get_account_details, get_contacts_for_account, get_email_data_for_account, get_teams_and_users, ) app_name = "accounts" urlpatterns = [ path("", AccountsListView.as_view(), name="list"), path("create/", CreateAccountView.as_view(), name="new_account"), path("<int:pk>/view/", AccountDetailView.as_view(), name="view_account"), path("<int:pk>/edit/", AccountUpdateView.as_view(), name="edit_account"), path("<int:pk>/delete/", AccountDeleteView.as_view(), name="remove_account"), path("comment/add/", AddCommentView.as_view(), name="add_comment"), path("comment/edit/", UpdateCommentView.as_view(), name="edit_comment"), path("comment/remove/", DeleteCommentView.as_view(), name="remove_comment"), path("attachment/add/", AddAttachmentView.as_view(), name="add_attachment"), path("attachment/remove/", DeleteAttachmentsView.as_view(), name="remove_attachment"),
from django.urls import path from accounts.views import AccountsHomeView, AccountsListView, JournalEntryView app_name = 'accounts' urlpatterns = [ path(r'', AccountsHomeView.as_view(), name='home'), path(r'journal', JournalEntryView.as_view(), name='journal_entry'), path(r'accounts-list', AccountsListView.as_view(), name='accounts_list'), ]
from django.urls import path from accounts.views import login_view, logout_view, register_view, UserDetailView, UserChangeView, \ UserChangePasswordView, AccountsListView app_name = 'accounts' urlpatterns = [ path('login/', login_view, name='login'), path('logout/', logout_view, name='logout'), path('register/', register_view, name='register'), path('profile/<pk>/', UserDetailView.as_view(), name='user_detail'), path('profile/<pk>/edit/', UserChangeView.as_view(), name='user_update'), path('profile/<pk>/change-password/', UserChangePasswordView.as_view(), name='user_change_password'), path('users/list', AccountsListView.as_view(), name='users_list') ]