示例#1
0
"""crud URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.8/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. 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
import api

from movie.views import MovieListView, MovieCreateView, MovieDeleteView, MovieDetailView

urlpatterns = [
    url(r'^movie_list/', MovieListView.as_view(), name="movie_list"),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^create_movie/', MovieCreateView.as_view(), name="create_movie"),
    url(r'^delete_movie/(?P<pk>\d+)/',MovieDeleteView.as_view(), name="delete_movie"),
    url(r'^movie_detail/(?P<pk>\d+)/',MovieDetailView.as_view(), name="movie_detail"),
    url(r'^api/', include('api.urls')),
]
示例#2
0
from django.conf.urls import url
from movie.views import MovieListView

urlpatterns = [url(r'^movies$', MovieListView.as_view(), name='movie_list')]
示例#3
0
from django.contrib import admin
from django.urls import path
from django.conf.urls import url
from movie.views import MovieListView, MovieDetailsView

urlpatterns = [
    # URL to list all movie. ?page= for page number and &movie or ?movie for query for name and type of movie
    url(r'^$', MovieListView.as_view(), name="movie-list"),

    # URL for details of the movie
    url(r'^(?P<pk>.*)/$', MovieDetailsView.as_view(), name="movie-details"),
]
示例#4
0
from django.conf.urls import include, url
from django.contrib import admin
import api

from movie.views import MovieListView, MovieCreateView, MovieDeleteView, MovieDetailView

urlpatterns = [
    url(r'^movie_list/', MovieListView.as_view(), name="movie_list"),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^create_movie/', MovieCreateView.as_view(), name="create_movie"),
    url(r'^delete_movie/(?P<pk>\d+)/',
        MovieDeleteView.as_view(),
        name="delete_movie"),
    url(r'^movie_detail/(?P<pk>\d+)/',
        MovieDetailView.as_view(),
        name="movie_detail"),
    url(r'^api/', include('api.urls')),
]
示例#5
0
from django.urls import path
from movie.views import MovieListView, MovieDetailView

urlpatterns = [
    path('api/', MovieListView.as_view()),
    path('api/<pk>', MovieDetailView.as_view()),
]