from books.views import (list_books, AuthorList, AuthorDetail, BookDetail, CreateAuthor, review_book, ReviewList) urlpatterns = [ # Auth # path('logout/', auth_views.logout_then_login(), name="logout"), path('accounts/', include('django.contrib.auth.urls')), # Admin path('admin/', admin.site.urls), # Custom path('', list_books, name='books'), path('authors/', AuthorList.as_view(), name="authors"), path('books/<int:pk>', BookDetail.as_view(), name="book-detail"), path('authors/add', login_required(CreateAuthor.as_view()), name="add-author"), path('authors/<int:pk>', AuthorDetail.as_view(), name="author-detail"), path('review/', login_required(ReviewList.as_view()), name='review-books'), path('review/<int:pk>', review_book, name='review-book'), ] if settings.DEBUG: import debug_toolbar urlpatterns += [ path('__debug__/', include(debug_toolbar.urls)), ]
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.conf.urls import include, url from django.contrib.auth.decorators import login_required from django.contrib.auth import views as auth_views from books.views import (AuthorDetail, AuthorList, BookDetail, CreateAuthor, list_books, ReviewList, review_book) urlpatterns = [ url(r'^logout/$', auth_views.logout, {'next_page': 'books'}, name='logout'), url(r'^login/$', auth_views.login, {'template_name': 'login.html'}, name='login'), url('^admin/', admin.site.urls), url(r'^$', list_books, name='books'), url(r'^authors/$', AuthorList.as_view(), name='authors'), url(r'^books/(?P<pk>[-\w]+)/$', BookDetail.as_view(), name='book-detail'), url(r'^authors/add/$', login_required(CreateAuthor.as_view()), name='add-author'), url(r'^authors/(?P<pk>[-\w]+)/$', AuthorDetail.as_view(), name='author-detail'), url(r'^review/$', login_required(ReviewList.as_view()), name='review-books'), url(r'^review/(?P<pk>[-\w]+)/$', review_book, name='review-book'), ]
auth_views.login, {'template_name': 'login.html'}, name='login'), # Admin url(r'^admin/', include(admin.site.urls)), # Custom url(r'^$', list_books, name='books'), url(r'^authors/$', AuthorList.as_view(), name='authors'), url(r'^books/(?P<pk>[-\w]+)/$', BookDetail.as_view(), name='book-detail'), url(r'^authors/add/$', login_required(CreateAuthor.as_view()), name='add-author'), url(r'^authors/(?P<pk>[-\w]+)/$', AuthorDetail.as_view(), name='author-detail'), url(r'^review/$', login_required(ReviewList.as_view()), name='review-books'), url(r'^review/(?P<pk>[-\w]+)/$', review_book, name='review-book'), ]
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.contrib.auth.decorators import login_required from django.contrib.auth import views as auth_views from books.views import (AuthorDetail, AuthorList, BookDetail, CreateAuthor, list_books, ReviewList, review_book) urlpatterns = [ # Auth url(r'^logout/$', auth_views.logout, {'next_page': 'books'}, name='logout'), url(r'^login/$', auth_views.login, {'template_name': 'login.html'}, name='login'), # Admin url(r'^admin/', include(admin.site.urls)), # Custom url(r'^$', list_books, name='books'), url(r'^authors/$', AuthorList.as_view(), name='authors'), url(r'^books/(?P<pk>[-\w]+)/$', BookDetail.as_view(), name='book-detail'), url(r'^authors/add/$', login_required(CreateAuthor.as_view()), name='add-author'), url(r'^authors/(?P<pk>[-\w]+)/$', AuthorDetail.as_view(), name='author-detail'), url(r'^review/$', login_required(ReviewList.as_view()), name='review-books'), url(r'^review/(?P<pk>[-\w]+)/$', review_book, name='review-book'), ]
from django.contrib import admin from django.conf.urls import include, url from django.contrib.auth.decorators import login_required from django.contrib.auth import views as auth_views from books.views import (AuthorDetail, AuthorList, BookDetail, list_books, review_book, ReviewList, CreateAuthor) urlpatterns = [ # Auth url(r'^logout/$', auth_views.logout, {'next_page': 'books' }, name='logout'), url(r'^login/$', auth_views.login, {'template_name': 'login.html' }, name='login'), # Admin url(r'^admin/', include(admin.site.urls)), # Custom url(r'^$', list_books, name='books'), url(r'^authors/$', AuthorList.as_view(), name='authors'), url(r'^books/(?P<pk>[-\w]+)/$', BookDetail.as_view(), name='book-detail'), url(r'^authors/add/$', login_required(CreateAuthor.as_view()), name='add-author'), url(r'^authors/(?P<pk>[-\w]+)/$', AuthorDetail.as_view(), name='author-detail'), url(r'^review/$', login_required(ReviewList.as_view()), name='review-books'), url(r'^review/(?P<pk>[-\w]+)/$', review_book, name='review-book'), ]
"""readit 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 books.views import (list_books, AuthorList, BookDetail, AuthorDetail, ReviewList, review_book) urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', list_books, name="books"), url(r'^authors/$', AuthorList.as_view(), name="authors"), url(r'^books/(?P<pk>[-\w]+)/$', BookDetail.as_view(), name="book-detail"), url(r'^authors/(?P<pk>[-\w]+)/$', AuthorDetail.as_view(), name="author-detail"), url(r'^review/$', ReviewList.as_view(), name='review-books'), url(r'^review/(?P<pk>[-\w]+)/$', review_book, name='review-book'), ]
from books.views import list_books, AuthorList, AuthorDetail, BookDetail, ReviewList, review_book, CreateAuthor from django.contrib.auth.decorators import login_required from django.contrib.auth import views as auth_views urlpatterns = [ # Auth url(r'^logout/$', auth_views.logout, {'next_page': 'books'}, name='logout'), url(r'^login/$', auth_views.login, {'template_name': 'login.html'}, name='login'), # Admin url(r'^admin/', admin.site.urls), # Custom url(r'^$', list_books, name='books'), url(r'^authors/$', AuthorList.as_view(), name='authors'), url(r'^books/(?P<pk>[-\w]+)/$', BookDetail.as_view(), name='book-detail'), url(r'^authors/add/$', login_required(CreateAuthor.as_view()), name='add-author'), url(r'^authors/(?P<pk>[-\w]+)/$', AuthorDetail.as_view(), name='author-detail'), url(r'review/$', login_required(ReviewList.as_view()), name='review-books'), url(r'review/(?P<pk>[-\w]+)/$', review_book, name='review-book'), ]
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 django.conf.urls import include, url from django.conf import settings from books.views import (Authorlist, list_books, BookDetail, AuthorDetail, CreateAuthor, review_book, ReviewList) urlpatterns = [ path('admin/', admin.site.urls), path('', list_books, name='books'), path('authors/', Authorlist.as_view(), name='authors'), path('books/<int:pk>/', BookDetail.as_view(), name='book-detail'), path('authors/add', CreateAuthor.as_view(), name='add-author'), path('author/<int:pk>/', AuthorDetail.as_view(), name='author-detail'), path('review/', ReviewList.as_view(), name='review-books'), path('review/<int:pk>/', review_book, name='review-book'), ] if settings.DEBUG: import debug_toolbar urlpatterns = [ url(r'^__debug__/', include(debug_toolbar.urls)), ] + urlpatterns
"""readit URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/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 books.views import (BookDetails, AuthorDetails, CreateAuthor, list_books, AuthorsList, ReviewList, review_book) urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', list_books, name="books"), url(r'^authors/add/$', CreateAuthor.as_view(), name="add-author"), url(r'^authors/$', AuthorsList.as_view(), name='authors'), url(r'^books/(?P<pk>[-\w])/$', BookDetails.as_view(), name="book_details"), url(r'^author/(?P<pk>[-\w])/$', AuthorDetails.as_view(), name="author_details"), url(r'^review/$', ReviewList.as_view(), name='review-books'), url(r'^review/(?P<pk>[-\w]+)/$', review_book, name='review-book'), ]