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'), ]
permission_required('books.add_book')(UpdateBook.as_view()), name="update-book"), url(r"^publisher/book/edit/(?P<pk>\d+)/$", permission_required('books.add_book')(ShowMyBook.as_view()), name="my-books-show"), url(r"^publisher/page/preview/$", permission_required('books.add_book')(PagePreview.as_view()), name="page-preview"), url(r"^publisher/page/edit/$", permission_required('books.add_book')(EditPage.as_view()), name="edit-page"), url(r"^publisher/page/edit/(?P<pk>\d+)/$", permission_required('books.add_book')(EditPageContent.as_view()), name="edit-page-content"), url(r"^publisher/author/create/$", permission_required('books.add_book')(CreateAuthor.as_view()), name="create-author"), ) # reading through books, rating etc... urlpatterns += patterns( "", url(r"^book/(?P<pk>\d+)/$", BookDetail.as_view(), name="book-detail"), url(r"^book/(?P<pk>\d+)/toc/$", login_required(BookTOC.as_view()), name="book-toc"), url(r"^book/(?P<pk>\d+)/read/$", login_required(ReadPage.as_view()), name="read-page"), url(r"^book/(?P<object_id>\d+)/rate/(?P<score>\d+)/$", AddRating.as_view(),
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'), ]
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 from books.views import (AuthorDetail, AuthorList, BookDetail, CreateAuthor, list_books, ReviewList, review_book) urlpatterns = [ url(r'^admin/', include(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'^authors/add/$', CreateAuthor.as_view(), name='add-author'), url(r'^review/$', ReviewList.as_view(), name='review-books'), url(r'^review/(?P<pk>[-\w]+)/$', review_book, name='review-book'), ]
name="publish-book"), url(r"^publisher/book/$", permission_required('books.add_book')(MyBooksView.as_view()), name="published-books"), url(r"^publisher/book/create/$", permission_required('books.add_book')(CreateBook.as_view()), name="create-book"), url(r"^publisher/book/update/(?P<pk>\d+)/$", permission_required('books.add_book')(UpdateBook.as_view()), name="update-book"), url(r"^publisher/book/edit/(?P<pk>\d+)/$", permission_required('books.add_book')(ShowMyBook.as_view()), name="my-books-show"), url(r"^publisher/page/preview/$", permission_required('books.add_book')(PagePreview.as_view()), name="page-preview"), url(r"^publisher/page/edit/$", permission_required('books.add_book')(EditPage.as_view()), name="edit-page"), url(r"^publisher/page/edit/(?P<pk>\d+)/$", permission_required('books.add_book')(EditPageContent.as_view()), name="edit-page-content"), url(r"^publisher/author/create/$", permission_required('books.add_book')(CreateAuthor.as_view()), name="create-author"), ) # reading through books, rating etc... urlpatterns += patterns("", url(r"^book/(?P<pk>\d+)/$", BookDetail.as_view(), name="book-detail"), url(r"^book/(?P<pk>\d+)/toc/$", login_required(BookTOC.as_view()), name="book-toc"), url(r"^book/(?P<pk>\d+)/read/$", login_required(ReadPage.as_view()), name="read-page"), url(r"^book/(?P<object_id>\d+)/rate/(?P<score>\d+)/$", AddRating.as_view(), name="book-rate"), )
from django.contrib import admin from django.urls import path from django.contrib.auth import views as auth_views from django.contrib.auth.decorators import login_required # from django.conf.urls import include, url #url based is old new is path based mapping from books.views import (list_books,AuthorList,CreateAuthor,BookDetail,AuthorDetail,review_book,ReviewList,logout_view) urlpatterns = [ # Login Logout path('logout/', logout_view, name= 'logout'), path('login/', auth_views.LoginView.as_view(template_name='login.html'), name= 'login'), # admin path('admin/', admin.site.urls), # Custom path('', list_books, name='books'), path('authors/', AuthorList.as_view(), name= 'authors'), path('book/<int:pk>/', BookDetail.as_view(), name = 'book-detail'), path('author/add/', login_required(CreateAuthor.as_view()), name='add-author'), path('author/<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'), ]
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'), ]