from django.urls import path, include from account.views import UserCreateView from django.contrib.auth.views import LoginView urlpatterns = [ path('login/', LoginView.as_view(template_name="account/login.html"), name="login"), path('', include('django.contrib.auth.urls')), path('signup', UserCreateView.as_view()), ]
"""food_manager URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 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 UserCreateView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^account/', include('account.urls', namespace='account')), url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), url(r'api-register/', UserCreateView.as_view(), name='registration') ]
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)
from django.urls import path, include from account.views import UserCreateView, ProfileView, ProfileUpdateView, AuthorRequestView, MyPostsView from django.contrib.auth.views import LoginView, PasswordResetView, PasswordResetDoneView, PasswordResetConfirmView, PasswordResetCompleteView, PasswordChangeView, PasswordChangeDoneView urlpatterns = [ path('signup', UserCreateView.as_view(), name='signup'), path('login/', LoginView.as_view(template_name="account/login.html"), name='login'), path('u/<slug:slug>', ProfileView.as_view(), name="profile-view"), path('u/<slug:slug>/update', ProfileUpdateView.as_view(), name="profile-update"), path('author-request', AuthorRequestView.as_view(), name="author-request"), path('my-posts', MyPostsView.as_view(), name="my-posts"), path('password-reset/', PasswordResetView.as_view(template_name="account/password_reset.html", email_template_name="account/password_reset_email.html"), name='password-reset'), path('password_reset/done/', PasswordResetDoneView.as_view(template_name="account/password_reset_done.html"), name='password-reset-done'), path('reset/<uidb64>/<token>/', PasswordResetConfirmView.as_view(template_name="account/password_reset_confirm.html"), name='password-reset-confirm'), path('reset/done/', PasswordResetCompleteView.as_view(template_name="account/password_reset_complete.html"), name='password-reset-complete'), path('password-change/', PasswordChangeView.as_view(template_name="account/password_change.html"), name='password-change'), path('password_change/done/', PasswordChangeDoneView.as_view(template_name="account/password_change_done.html"), name='password-change-done'), path('', include('django.contrib.auth.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 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 UserCreateView, profile_page_view,UpdateProfileView from django.contrib.auth.views import LoginView, PasswordResetView, PasswordResetDoneView, PasswordResetConfirmView, PasswordResetCompleteView, PasswordChangeView,PasswordChangeDoneView urlpatterns = [ path('signup/', UserCreateView.as_view(template_name="account/signup.html"), name="signup"), path('login/', LoginView.as_view(template_name="account/login.html"), name="login"), path('', include('django.contrib.auth.urls')), path('profile/', profile_page_view, name='profile'), path('profile/<int:pk>', UpdateProfileView.as_view(), name="ProfileUpdate"), path('password-reset/', PasswordResetView.as_view(template_name="account/password_reset_form.html", email_template_name="account/password_reset_email.html"), name='password_reset'), path('password-reset/done/', PasswordResetDoneView.as_view(template_name="account/password_reset_done.html"), name='password_reset_done'), path('reset/<uidb64>/<token>/', PasswordResetConfirmView.as_view(template_name="account/password_confirm.html"), name='password_reset_confirm'), path('reset/done/', PasswordResetCompleteView.as_view(template_name="account/password_reset_complete.html"), name='password_reset_complete'), path('password-change/', PasswordChangeView.as_view(template_name='account/password_change.html'), name='password_change'), path('password-change/done/', PasswordChangeDoneView.as_view(template_name='account/password_change_done.html'), name='password_change_done'), ]
from django.conf.urls import url from django.urls import include from account.views import UserCreateView, UserCreateDoneTemplateView from . import views from django.conf import settings from django.conf.urls.static import static urlpatterns = [ url(r'^accounts/', include('django.contrib.auth.urls')), url(r'^accounts/register/$', UserCreateView.as_view(), name='register'), url(r'^accounts/register/done/$', UserCreateDoneTemplateView.as_view(), name='register_done'), ]