The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.0/topics/http/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 movielist.views import MovieListView, MovieView from showtimes.views import CinemaView, CinemaListView, ScreeningListView, ScreeningView urlpatterns = [ path('admin/', admin.site.urls), path('movies/', MovieListView.as_view(), name='movies'), path('movies/<int:pk>/', MovieView.as_view(), name='movies-detail'), path('cinemas/', CinemaListView.as_view(), name='cinemas'), path('cinemas/<int:pk>/', CinemaView.as_view(), name='cinemas-detail'), path('screenings/', ScreeningListView.as_view(), name='screenings'), path('screenings/<int:pk>/', ScreeningView.as_view(), name='screenings-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. 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 from django.urls import path, re_path from django.contrib import admin from movielist.views import MovieListView, MovieView from showtimes.views import CinemaListView, CinemaView, ScreeningListView, ScreeningView, FilteredScreeningListView, FilteredCinemaListView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^movies/$', MovieListView.as_view()), url(r'^movies/(?P<pk>[0-9]+)', MovieView.as_view(), name='moviedetail'), url(r'^cinemas/$', CinemaListView.as_view()), url(r'^cinemas/(?P<pk>[0-9]+)', CinemaView.as_view(), name='cinemadetail'), url(r'^screening/$', ScreeningListView.as_view()), url(r'^screening/(?P<pk>[0-9]+)', ScreeningView.as_view(), name='screeningdetail'), url(r'^screening/(?P<title>[a-zA-Z ]+)', FilteredScreeningListView.as_view()), url(r'^cinemas/(?P<city>[a-zA-Z ]+)', FilteredCinemaListView.as_view()), ]
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 from django.contrib import admin from movielist.views import MovieListView, MovieView from showtimes.views import CinemaListView, CinemaView, ScreeningListView, ScreeningView, Next30DaysScreeningsView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^movies/$', MovieListView.as_view(), name='movie-list'), url(r'^movies/(?P<pk>[0-9]+)/$', MovieView.as_view(), name='movie-detail'), url(r'^cinemas/$', CinemaListView.as_view(), name='cinema-list'), url(r'^cinemas/(?P<pk>[0-9]+)/$', CinemaView.as_view(), name='cinema-detail'), url(r'^cinemas_timetable/(?P<pk>[0-9]+)/$', Next30DaysScreeningsView.as_view(), name='cinema-repertoire'), url(r'^screenings/$', ScreeningListView.as_view(), name='screening-list'), url(r'^screenings/(?P<pk>[0-9]+)/$', ScreeningView.as_view(), name='screening-detail'), ]
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 movielist.views import MovieListView, MovieView from showtimes.views import CinemaListView, CinemaView, ScreeningListView, ScreeningView # API endpoints urlpatterns = [ path('admin/', admin.site.urls), path('movies/', MovieListView.as_view()), path('movies/<int:pk>/', MovieView.as_view(), name="movie-details"), path('cinemas/', CinemaListView.as_view(), name='cinemas-list'), path('cinemas/<int:pk>/', CinemaView.as_view(), name='cinema-view'), path('screenings/', ScreeningListView.as_view({ 'get': 'list', 'post': 'create', 'put': 'update' }), name='screenings-list'), path('screenings/<int:pk>/', ScreeningView.as_view(), name='screening-view'), ]
urlpatterns = [ # Main views re_path(r'^admin/', admin.site.urls), re_path(r"^$", api_root), re_path(r"schema/?$", schema_view), # User views re_path(r'^users/?$', UserListView.as_view(), name="users"), re_path(r'^users/(?P<pk>[0-9]+)/?$', UserDetailView.as_view(), name="user-detail"), re_path(r"^current_user/?$", current_user), # Movies re_path(r'^movies/?$', MovieListView.as_view(), name="movies"), re_path(r'^movies/(?P<pk>[0-9]+)/?$', MovieView.as_view(), name="movie-detail"), # Cinemas re_path(r'^cinemas/?$', CinemaListView.as_view(), name="cinemas"), re_path(r'^cinemas/(?P<pk>[0-9]+)/?$', CinemaView.as_view(), name="cinema-detail"), # Screenings re_path(r'^screenings/?$', ScreeningsListView.as_view(), name="screenings"), re_path(r'^screenings/(?P<pk>[0-9]+)/?$', ScreeningView.as_view(),
""" from django.conf.urls import url from django.urls import re_path from django.contrib import admin from movielist.views import MovieListView, MovieView from showtimes.views import ( CinemaListView, CinemaView, ScreeningListView, ScreeningsView, ) urlpatterns = [ url(r'^admin/', admin.site.urls), re_path(r'^movies/$', MovieListView.as_view(), name='movie-list-view'), re_path(r'^movies/(?P<pk>[0-9]+)/$', MovieView.as_view(), name='movie-detail-view'), re_path(r'^cinemas/$', CinemaListView.as_view(), name='cinema-list-view'), re_path(r'^cinemas/(?P<pk>[0-9]+)/$', CinemaView.as_view(), name='cinema-detail-view'), re_path(r'^screenings/$', ScreeningListView.as_view(), name='screening-list-view'), re_path(r'^screenings/(?P<pk>[0-9]+)/$', ScreeningsView.as_view(), name='screening-detail-view'), ]