示例#1
0
"""w_rest 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
from django.contrib import admin
from movies.views import MoviesView, MovieView, PersonsView, PersonView


urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^movies/$', MoviesView.as_view()),
    url(r'^movies/(?P<id>(\d)+)', MovieView.as_view()),
    url(r'^persons/$', PersonsView.as_view()),
    url(r'^persons/(?P<id>(\d)+)', PersonView.as_view()),
]
示例#2
0
"""REST_Server 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
from django.contrib import admin
from movies.views import MoviesView, MovieView, PersonsView, PersonView

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^movies/$', MoviesView.as_view(), name='movies'),
    url(r'^movies/(?P<id>(\d)+)', MovieView.as_view(), name='movies'),
    url(r'^persons/$', PersonsView.as_view(), name='persons'),
    url(r'^persons/(?P<id>(\d)+)', PersonView.as_view(), name='movie')
]
示例#3
0
"""work6 URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.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 movies.views import MoviesView, MovieView, PersonView, PersonsView, AssignDirectorMovie, dziwnyWidok

urlpatterns = [
    path('admin/', admin.site.urls),
    path('movies', MoviesView.as_view()),
    path('movies/<int:id>', MovieView.as_view()),
    path('persons/<int:id>', PersonView.as_view()),
    path('persons/', PersonsView.as_view()),
    path('movies/<int:movie_id>/director/<int:person_id>',
         AssignDirectorMovie.as_view()),
    path('s', dziwnyWidok),
]