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 patterns, include, url from greetings.views import HomePage from django.contrib import admin from teams.views import TeamList urlpatterns = patterns( '', url(r'^admin/', include(admin.site.urls)), url(r'^$', HomePage.as_view(), name="home"), # using a class based view url(r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}), url(r'^logout/$', 'django.contrib.auth.views.logout', {'next_page': '/login/'}), url(r'^signup/$', 'subscribers.views.subscriber_new', name='sub_new'), # using a function based view url(r'^subscriber/$', 'subscribers.views.subscriber_details', name='sub_det'), # using a function based view url(r'^team/list/$', TeamList.as_view(), name='team_list'), # CBV url(r'^team/new/$', 'teams.views.team_create', name='team_cre'), url(r'^team/(?P<uuid>[\w-]+)/$', 'teams.views.team_details', name='team_det'), url(r'^team/(?P<uuid>[\w-]+)/edit/$', 'teams.views.team_update', name='team_upd'), url(r'^team/(?P<uuid>[\w-]+)/join/$', 'teams.views.team_join', name='team_joi'), url(r'^team/(?P<uuid>[\w-]+)/leave/$', 'teams.views.team_leave', name='team_lea'), url(r'^scores/$', 'scores.views.scores_details', name='scores_det'), url(r'^persistScore/$', 'scores.views.persist_score', name='scores_per') )
from django.urls import path from teams.views import TeamList, TeamDetail urlpatterns = [ path('teams/', TeamList.as_view()), path('teams/<int:pk>/', TeamDetail.as_view()), ]
from teams.views import PersonDetail, PositionDetail, SquadList, SquadDetail, \ TeamList, TeamDetail from django.conf.urls import patterns, url urlpatterns = patterns('teams.views', url(r'^$', TeamList.as_view(), name='team_list'), url(r'^team/(?P<slug>[-\w]+)/$', TeamDetail.as_view(), name='team_detail'), url(r'^squad/$', SquadList.as_view(), name='squad_list'), url(r'^squad/(?P<slug>[-\w]+)/$', SquadDetail.as_view(), name='squad_detail'), url(r'^person/(?P<slug>[-\w]+)/$', PersonDetail.as_view(), name='team_person_detail'), url(r'^position/(?P<slug>[-\w]+)/$', PositionDetail.as_view(), name='position_detail'), )
# Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', #url(r'^$', 'app.views.home'), # Examples: # url(r'^$', 'app.views.home', name='home'), # url(r'^app/', include('app.foo.urls')), # Uncomment the admin/doc line below to enable admin documentation: # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: url(r'^$', TeamList.as_view()), url(r'^admin/', include(admin.site.urls)), ) # Uncomment the next line to serve media files in dev. # urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) # if settings.DEBUG: # import debug_toolbar # urlpatterns += patterns('', # url(r'^__debug__/', include(debug_toolbar.urls)), # )
# -*- coding: utf-8 -*- from django.conf.urls import patterns, url from teams.views import TeamList, TeamDetail __author__ = 'jesuscc29' urlpatterns = patterns('', url(r'^equipos/$', TeamList.as_view(), name='team_list'), url(r'^equipos/(?P<pk>\d+)/$', TeamDetail.as_view(), name='team_detail'), )
from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() from django.contrib.auth.decorators import login_required from teams.views import MakeTeamView, TeamList urlpatterns = patterns('', url(r'^teams/new/', login_required(MakeTeamView.as_view()), name="new"), url(r'^teams/search/$', 'teams.views.search_team', name='search'), url(r'^teams/([0-9]+)/join/$', 'teams.views.join_team', name="join"), url( r'^teams/([0-9]+)/accept/users/([0-9]+)/$', 'teams.views.accept_request_to_join_team', name = 'accept', ), url(r'^teams/([0-9]+)/$', 'teams.views.team_page', name='team_page'), url(r'^teams/$', TeamList.as_view(), name="teamlist"), )
from teams.views import PersonDetail, PositionDetail, SquadList, SquadDetail, \ TeamList, TeamDetail from django.conf.urls import patterns, url urlpatterns = patterns( 'teams.views', url(r'^$', TeamList.as_view(), name='team_list'), url(r'^team/(?P<slug>[-\w]+)/$', TeamDetail.as_view(), name='team_detail'), url(r'^squad/$', SquadList.as_view(), name='squad_list'), url(r'^squad/(?P<slug>[-\w]+)/$', SquadDetail.as_view(), name='squad_detail'), url(r'^person/(?P<slug>[-\w]+)/$', PersonDetail.as_view(), name='team_person_detail'), url(r'^position/(?P<slug>[-\w]+)/$', PositionDetail.as_view(), name='position_detail'), )