Including another URLconf 1. Add an import: from blog import urls as blog_urls 2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls)) """ from django.conf.urls import include, url from django.contrib import admin from django.views.generic import TemplateView from user_profile.views import ProfileView # Wire up our API using automatic URL routing. # Additionally, we include login URLs for the browsable API. urlpatterns = [ url(r'^', include('frontpage.urls', namespace='frontpage'), name="frontpage"), url(r'^profile/$', ProfileView.as_view(), name='user_profile'), url( r'^robots\.txt/$', TemplateView.as_view(template_name='robots.txt', content_type='text/plain')), url(r'^accounts/', include('register.urls')), url(r'^app/login/', 'register.views.login'), url(r'^app/logout/', 'register.views.logout'), url(r'^app/password_change/', 'register.views.password_change'), url(r'^app/', include(admin.site.urls)), url(r'^autocomplete/', include('autocomplete_light.urls')), url(r'api/v1/', include('rest_api.urls')), # Add "v1" to indicate the version. url(r'^comments/', include('comments.urls')), ]
from django.conf.urls import url from django.contrib.auth.decorators import login_required from user_profile.views import ProfileView, ProfileEdit, OrderList, OrderDetail urlpatterns = [ url(r'^$', login_required(ProfileView.as_view()), name='profile_main'), url(r'^edit/(?P<pk>[0-9]+)/$', ProfileEdit.as_view(), name='profile_edit'), url(r'^orders/$', OrderList.as_view(), name='orders'), url(r'^orders/(?P<pk>[0-9]+)/$', OrderDetail.as_view(), name='order_detail'), ]
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. Add an import: from blog import urls as blog_urls 2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls)) """ from django.conf.urls import include, url from django.contrib import admin from django.views.generic import TemplateView from user_profile.views import ProfileView # Wire up our API using automatic URL routing. # Additionally, we include login URLs for the browsable API. urlpatterns = [ url(r'^', include('frontpage.urls', namespace='frontpage')), url(r'^profile/$', ProfileView.as_view(), name='user_profile'), url(r'^robots\.txt/$', TemplateView.as_view(template_name='robots.txt', content_type='text/plain')), url(r'^accounts/', include('register.urls')), url(r'^app/login/', 'register.views.login'), url(r'^app/logout/', 'register.views.logout'), url(r'^app/password_change/', 'register.views.password_change'), url(r'^app/', include(admin.site.urls)), url(r'^autocomplete/', include('autocomplete_light.urls')), url(r'api/v1/', include('rest_api.urls')), # Add "v1" to indicate the version. url(r'^comments/', include('comments.urls')), ]
import django.contrib.auth.views as auth_views from django.conf.urls import url from user_profile.views import AvailabilityView from user_profile.views import DeleteUserView, UserListView, StatisticsView from user_profile.views import EditMyProductsView from user_profile.views import EmailLoginView from user_profile.views import ProfileView, CreateUserView, UnitListView urlpatterns = [ url(r'^$', ProfileView.as_view(template_name='profile/profile.html'), name='user_profile'), url(r'^login/', auth_views.LoginView.as_view(template_name='profile/login.html'), name='standard_login'), url(r'^email-login/(?P<slug>[a-f0-9-]+)(?P<dest_url>.*)', EmailLoginView.as_view(), name='email-login'), url(r'^logout/', auth_views.LogoutView.as_view(template_name='profile/logout.html'), name='logout'), url(r'^user/create$', CreateUserView.as_view(template_name='profile/create_user.html', success_url='create'), name='user_create'), url(r'^users/?$', UserListView.as_view(), name='user_list'), url(r'^user/(?P<pk>[0-9]+)/?$', CreateUserView.as_view(), name='user_edit'), url(r'^user/(?P<pk>[0-9]+)/delete/?$', DeleteUserView.as_view(),
from django.conf.urls import * from user_profile.views import ProfileView, PostsView urlpatterns = patterns('user_profile.views', url(r'^$', ProfileView.as_view(), name='profile'), url(r'^groups$', 'show_groups', name='groups'), url(r'^posts$', PostsView.as_view(), name='posts'), url(r'^datebook$', 'show_datebook', name='datebook'), )
url(r'^register/applicant/$', ApplicantRegistrationView.as_view(), name='registration_register_applicant'), url(r'^register/employer/$', EmployerRegistrationView.as_view(), name='registration_register_employer'), url(r'^register/agency/$', AgencyRegistrationView.as_view(), name='registration_register_agency'), url(r'^register/complete/$', TemplateView.as_view(template_name='registration/registration_complete.html'), name='registration_complete'), url(r'^register/closed/$', TemplateView.as_view(template_name='registration/registration_closed.html'), name='registration_disallowed'), (r'', include('registration.auth_urls')), url(r'^profile/$', login_required(ProfileView.as_view(), login_url='/accounts/login/'), name='profile_update'), url(r'^profile/edit/$', login_required(CustomProfileView.as_view(), login_url='/accounts/login/'), name='profile_update'), url(r'^password_change/$', my_change_password, name='change_pass'), url(r'^password_change_done/$', TemplateView.as_view(template_name='registration/password_change_done.html'), name='change_pass_done'), url(r'^logout/$', 'django.contrib.auth.views.logout', {'next_page': '/'}) )
from django.urls import re_path from user_profile.views import get_profile, create_profile, ProfileView urlpatterns = [ re_path(r'^$', get_profile), re_path(r'^create/$', create_profile), re_path(r'^(?P<profile_id>\d+)/', get_profile), re_path(r'^(?P<profile_id>\d+)/', ProfileView.as_view()), ]