""" from django.conf.urls import url from users import views from users.views import ( UserCreateView, UserProfileView, UserUpdateView, UserDeleteView, UserFavoriteView, ) urlpatterns = [ url(r'^search$', views.user_search), url(r'^signup/$', UserCreateView.as_view(), name='signup'), url(r'^signup/confirm/(?P<token>\w+)/$', views.user_create_confirm, name='signup_confirm'), url(r'^login/$', views.user_login, name='login'), url(r'^logout/$', views.user_logout, name='logout'), url(r'^reset/$', views.user_request_reset_password, name='request_password_reset'), url(r'^reset/(?P<token>\w+)/$', views.user_reset_password, name='password_reset'), url(r'^update-password/$', views.user_password, name='update-password'), url(r'^(?P<pk>\d+)/$', UserProfileView.as_view(), name='profile'), url(r'^(?P<username>[^/]+)/$', views.user_profile_by_username, name='profile_username'), url(r'^(?P<pk>\d+)/edit/$', UserUpdateView.as_view(), name='edit'), url(r'^(?P<pk>\d+)/delete/$', UserDeleteView.as_view(), name='delete'), url(r'^(?P<pk>\d+)/favorites/$', UserFavoriteView.as_view(), name='favorites'), url(r'^notification/(?P<pk>\d+)/see/$', views.see_nofitication, name='see_notification'), url(r'^notification/mark-all/$', views.mark_all_as_read, name='mark_notifications_as_read'), url(r'^notification/show-all/$', views.show_all_notifications, name='show_all_notifications') ]
path('profile/', OrderListView.as_view(), name='profile-orders-list'), path('profile/orders/<int:pk>/delete/', OrderDeleteView.as_view(), name='order-delete'), path('profile/orders/order_create/', OrderCreateView.as_view(), name='order-create'), path('profile/orders/<int:pk>/', OrderDetailView.as_view(), name='order-detail'), path('profile/orders/<int:pk>/update/', OrderUpdateView.as_view(), name='order-update'), path('profile/update/', views_users.profile, name='profile-update'), path('profile/<int:pk>/delete/', UserDeleteView.as_view(), name='profile-delete'), path('profile/password-reset/', views_auth.PasswordResetView.as_view( template_name='users/password_reset.html'), name='users-password-reset'), path('profile/password-reset/done/', views_auth.PasswordResetDoneView.as_view( template_name='users/password_reset_done.html'), name='password_reset_done'), path('profile/password-reset-confirm/<uidb64>/<token>/', views_auth.PasswordResetConfirmView.as_view( template_name='users/password_reset_confirm.html'), name='password_reset_confirm'), path('profile/password-reset-complete/', views_auth.PasswordResetCompleteView.as_view(
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 path from django.conf.urls import include, url from users import views as user_views from django.conf import settings from django.conf.urls.static import static from users.views import UserUpdateView, UserDeleteView urlpatterns = [ path('admin/', admin.site.urls), path('', user_views.start, name='start'), path('register/', user_views.register, name='register'), path('profile/', user_views.profile, name='profile'), path('profile/update/', UserUpdateView.as_view(), name='profile-update'), path('profile/delete/', UserDeleteView.as_view(), name='profile-delete'), path('login/', auth_views.LoginView.as_view(template_name='users/login.html'), name='login'), path('logout/', auth_views.LogoutView.as_view(template_name='users/logout.html'), name='logout'), url(r'^tree/', include('tree.urls')), ] urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
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.urls import path from users.views import CustomPasswordChangeView, CustomPasswordResetView, UsersCreateView, UserUpdateView, \ UserDetailView, UserDeleteView, UsersListView, UsersCreateNewView, UserUpdateClientView app_name = 'users' urlpatterns = [ path('change-password/', CustomPasswordChangeView.as_view(), name='change_password'), path('password-reset/', CustomPasswordResetView.as_view(), name='reset_password'), path('', UsersListView.as_view(), name='index'), path('create', UsersCreateView.as_view(), name='create'), path('createuser', UsersCreateNewView.as_view(), name='createuser'), path('edit', UserUpdateClientView.as_view(), name='edit'), path('update/<int:pk>/', UserUpdateView.as_view(), name='update'), path('detail/<int:pk>/', UserDetailView.as_view(), name='detail'), path('delete/<int:pk>/', UserDeleteView.as_view(), name='delete'), ]
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 path from users.views import (registerView, homeView, UserCreateView, UserUpdateView, UserDeleteView) urlpatterns = [ path('admin/', admin.site.urls), path('login/', auth_views.LoginView.as_view(template_name='login.html'), name='login'), path('logout/', auth_views.LogoutView.as_view(template_name='logout.html'), name='logout'), path('register/', registerView, name='register'), path('', homeView, name='user-home'), path('user/new/', UserCreateView.as_view(), name='user-create'), path('user/<int:pk>/update', UserUpdateView.as_view(), name='user-update'), path('user/<int:pk>/delete', UserDeleteView.as_view(), name='user-delete'), ]
from django.urls import path from users.views import UserList, UserDetailView, UserCreateView, UserUpdateView, UserDeleteView, exportToCSV app_name = 'users' urlpatterns = [ path('', UserList.as_view(), name='user-list'), path('user/<int:pk>/', UserDetailView.as_view(), name='user-detail'), path('user/create', UserCreateView.as_view(), name='user-create'), path('user/update/<int:pk>/', UserUpdateView.as_view(), name='user-update'), path('user/delete/<int:pk>/', UserDeleteView.as_view(), name='user-delete'), path('export', exportToCSV, name='user-export'), ]
views.user_create_confirm, name='signup_confirm'), url(r'^login/$', views.user_login, name='login'), url(r'^logout/$', views.user_logout, name='logout'), url(r'^reset/$', views.user_request_reset_password, name='request_password_reset'), url(r'^reset/(?P<token>\w+)/$', views.user_reset_password, name='password_reset'), url(r'^update-password/$', views.user_password, name='update-password'), url(r'^(?P<pk>\d+)/$', UserProfileView.as_view(), name='profile'), url(r'^(?P<username>[^/]+)/$', views.user_profile_by_username, name='profile_username'), url(r'^(?P<pk>\d+)/edit/$', UserUpdateView.as_view(), name='edit'), url(r'^(?P<pk>\d+)/delete/$', UserDeleteView.as_view(), name='delete'), url(r'^(?P<pk>\d+)/favorites/$', UserFavoriteView.as_view(), name='favorites'), url(r'^notification/(?P<pk>\d+)/see/$', views.see_nofitication, name='see_notification'), url(r'^notification/mark-all/$', views.mark_all_as_read, name='mark_notifications_as_read'), url(r'^notification/show-all/$', views.show_all_notifications, name='show_all_notifications') ]