from django.contrib import admin from django.urls import path, include from account.views import SignUpView, UserUpdateView, UserDetailView, password_reset_complete # from django.contrib.auth.views import LoginView urlpatterns = [ path('', include("django.contrib.auth.urls")), path("Sign Up", SignUpView.as_view(), name='Sign Up'), path("<int:pk>", UserDetailView.as_view(), name='Details'), path('<int:pk>/Update', UserUpdateView.as_view(), name='Update'), path('password_reset_complete', password_reset_complete, name='password_reset_complete'), ]
url(r'^threads/$', SongthreadListView.as_view(), name='songthread_list'), url(r'^thread/add/$', SongthreadCreateView.as_view(), name='songthread_create'), url(r'^thread/(?P<slug>[-\w\d]+)/(?P<pk>\d+)/$', SongthreadDetailView.as_view(), name='songthread_detail'), url(r'^song/add/(?P<songthread_id>\d+)/$', login_required(SongCreateView.as_view()), name='song_create'), url(r'^vote/(?P<song_id>\d+)/(?P<like>\d+)/$', login_required(VoteCreateView.as_view()), name='vote_create'), url(r'^comment/(?P<songthread_id>\d+)/$', CommentCreateView.as_view(), name='comment_create'), url(r'^admin/doc/', include('django.contrib.admindocs.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^accounts/login/$', 'django.contrib.auth.views.login', name='login'), url(r'^accounts/logout/$', 'django.contrib.auth.views.logout', name='logout'), url(r'^accounts/register/$', UserCreateView.as_view(), name='register'), url(r'^accounts/profile/$', UserUpdateView.as_view(), name='edit_profile'), url(r'^view-profile/(?P<slug>[-\w\d]+)/(?P<pk>\d+)/$', UserDetailView.as_view(), name='view_profile'), url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}) ) if DEBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings. MEDIA_ROOT)
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url, include from django.contrib import admin from account.views import (login_view, home_view, logout_view, register_view, member_leave_view, UserUpdateView, admin_member_list_view, member_list_view, member_detail_view, OnlyAdminUserUpdateView) urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', home_view, name='home'), url(r'^register/', register_view, name='register'), url(r'^login/', login_view, name='login'), url(r'^logout/', logout_view, name='logout'), url(r'^user_list/$', member_list_view, name='list'), url(r'^user_list/(?P<pk>\d+)/$', member_detail_view, name='detail'), url(r'^user_list/(?P<pk>\d+)/edit/', UserUpdateView.as_view(), name='update'), url(r'^user_list/(?P<pk>\d+)/delete/$', member_leave_view, name='leave'), url(r'^customadmin/user_list/$', admin_member_list_view, name='admin-user-list'), url(r'^customadmin/user_list/(?P<pk>\d+)/edit/$', OnlyAdminUserUpdateView.as_view(), name='admin-user-update'), url(r'^api/', include("account.api.urls", namespace="account-api")), ]
from django.conf.urls import url from account.views import UserListView, UserAddView, UserUpdateView, GroupListView, GroupAddView, GroupUpdateView, UserDeleteView, GroupDeleteView from django.views.decorators.csrf import csrf_exempt urlpatterns = [ url(r"^user/list/$", csrf_exempt(UserListView.as_view()), name="user_list"), url(r"^user/add/$", csrf_exempt(UserAddView.as_view()), name="user_add"), url(r"^user/update/(?P<id>[0-9]+)/$", csrf_exempt(UserUpdateView.as_view()), name="user_update"), url(r"^user/delete/(?P<id>[0-9]+)/$", csrf_exempt(UserDeleteView.as_view()), name="user_delete"), url(r"^group/list/$", csrf_exempt(GroupListView.as_view()), name="group_list"), url(r"^group/add/$", csrf_exempt(GroupAddView.as_view()), name="group_add"), url(r"^group/update/(?P<id>[0-9]+)/$", csrf_exempt(GroupUpdateView.as_view()), name="group_update"), url(r"^group/delete/(?P<id>[0-9]+)/$", csrf_exempt(GroupDeleteView.as_view()), name="group_delete") ]
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 account.views import home_view, user_create_view, dynamic_lookup_view, user_delete_view, user_list_view,\ UserListView, UserSingleView, UserCreateView, UserUpdateView, UserDeleteView urlpatterns = [ # path('', user_list_view, name='user-list'), path('', UserListView.as_view(), name='user-list'), # path('user/<int:id>', dynamic_lookup_view, name='user'), path('user/<int:id>', UserSingleView.as_view(), name='user'), path('admin/', admin.site.urls), # path('create/', user_create_view), path('create/', UserCreateView.as_view(), name='user-create'), path('user/<int:id>/update/', UserUpdateView.as_view(), name='user-update'), # path('user/<int:id>/delete/', user_delete_view, name='user-delete'), path('user/<int:id>/delete/', UserDeleteView.as_view(), name='user-delete'), ]
from django.urls import path, include from account.views import SignUpView, UserDetailsView, UserUpdateView, UserDeleteView urlpatterns = [ path("", include('django.contrib.auth.urls')), path("signup", SignUpView.as_view(), name='signup'), path('user_view/<int:id>', UserDetailsView.as_view(), name='detailuser'), path("user_update/<int:id>", UserUpdateView.as_view(), name='updateuser'), path("user_delete/<int:id>", UserDeleteView.as_view(), name='deleteuser'), ]