コード例 #1
0
 def test_access(self):
     book = mixer.blend('books.Book', name='Two Scoops Of DJANGO')
     req = RequestFactory().get('/books/two_scoops_of_django')
     req.user = mixer.blend(User)
     resp = BookDetailView.as_view()(req, slug=book.slug)
     assert resp.status_code == 200, 'Should display detail view'
コード例 #2
0
ファイル: urls.py プロジェクト: sadjad-tavakoli/farjad-agile
from django.urls.conf import path, include

from books.views import BookDetailView, BookUpdateView, BooksListView, BooksListAPIView, \
    CreateBookAPIView
from comment.views import AddCommentAPIView

app_name = "book"

api_urlpatterns = ([
    path(r'', BooksListAPIView.as_view(), name="all"),
    path(r'create/', CreateBookAPIView.as_view(), name="create"),
], 'api')

urlpatterns = [
    path('', BooksListView.as_view(), name='all'),
    path(r'api/', include(api_urlpatterns), name="api"),
    path('<int:book_pk>/', BookDetailView.as_view(), name='detail'),
    path('<int:book_pk>/edit/', BookUpdateView.as_view(), name='edit'),
    path('<int:book_pk>/comment/', AddCommentAPIView.as_view(),
         name='comment'),
]
コード例 #3
0
from django.urls import path

from books.views import BookListView, BookDetailView

urlpatterns = [
    path('', BookListView.as_view(), name='book_list'),
    path('<uuid:pk>', BookDetailView.as_view(), name='book_detail'),
]
コード例 #4
0
from django.urls import path

from books.views import (AuthorCreateView, AuthorDeleteView, AuthorListView,
                         AuthorUpdateView, BookCreateView, BookDeleteView,
                         BookDetailView, BookListView, BookListViewDF,
                         BookUpdateView, GenreCreateView, GenreDeleteView,
                         GenreListView, GenreUpdateView)

urlpatterns = [
    path("bookstore/books/", BookListView.as_view(), name="bookstore"),
    path("bookstore/book/add-book", BookCreateView.as_view(), name="book-add"),
    path("bookstore/book/<int:pk>/",
         BookDetailView.as_view(),
         name="book-details"),
    path("bookstore/book/<int:pk>/update/",
         BookUpdateView.as_view(),
         name="book-update"),
    path("bookstore/book/<int:pk>/delete/",
         BookDeleteView.as_view(),
         name="book-delete"),
    path("bookstore/author/create/",
         AuthorCreateView.as_view(),
         name="author-add"),
    path("bookstore/authors/", AuthorListView.as_view(), name="authors"),
    path(
        "bookstore/author/<int:pk>/update",
        AuthorUpdateView.as_view(),
        name="author-update",
    ),
    path(
        "bookstore/author/<int:pk>/delete",
コード例 #5
0
"""crudCBV URL Configuration

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, include
from books.views import BookListView, BookCreateView, BookDetailView, BookUpdateView, BookDeleteView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', BookListView.as_view(), name='home'),
    path('create/', BookCreateView.as_view(), name='create'),
    path('detail/<int:pk>', BookDetailView.as_view(), name='detail'),
    path('update/<int:pk>', BookUpdateView.as_view(), name='update'),
    path('delete/<int:pk>', BookDeleteView.as_view(), name='delete'),
]
コード例 #6
0
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, include
from books.views import JournalHome, JournalDetailView, JournalListView, JournalCreateView, JournalUpdateView, JournalDeleteView
from books.views import BookHome, BookDetailView, BookListView, BookCreateView, BookUpdateView, BookDeleteView, HomePageView, SearchView
from django.conf.urls.static import static

urlpatterns = [
    path('book/', BookHome.as_view(), name='book-home'),
    path('book/<int:pk>/', BookDetailView.as_view(), name='select-book'),
    path('book/list/', BookListView.as_view(), name='book-list'),
    path('book/create/', BookCreateView.as_view(), name='create-book'),
    path('book/update/<int:pk>/', BookUpdateView.as_view(),
         name='update-book'),
    path('book/delete/<int:pk>/', BookDeleteView.as_view(),
         name='delete-book'),
    path('journal/', JournalHome.as_view(), name='journal-home'),
    path('journal/<int:pk>/',
         JournalDetailView.as_view(),
         name='select-journal'),
    path('journal/list/', JournalListView.as_view(), name='journal-list'),
    path('journal/create/', JournalCreateView.as_view(),
         name='create-journal'),
    path('journal/update/<int:pk>/',
         JournalUpdateView.as_view(),
コード例 #7
0
from django.urls import path
from books.views import PublisherList, BookList, AuthorList
from books.views import PublisherDetailView, BookDetailView, AuthorDetailView

app_name = 'books'
urlpatterns = [
    path('publishers/', PublisherList.as_view()),
    path('publishers/<int:pk>/', PublisherDetailView.as_view()),
    path('books/', BookList.as_view()),
    path('books/<int:pk>/', BookDetailView.as_view()),
    path('authors/', AuthorList.as_view()),
    path('authors/<int:pk>/', AuthorDetailView.as_view()),
]

コード例 #8
0
from books.views import (BookListView, GenreListView, GenreDetailView,
                         BookDetailView, CreateCommentView, InfoView,
                         UserLikesView, RegistrationView, LoginView,
                         UserAccountView, BuyBook, DeleteBook, SearchView,
                         RegistretionNewGenre, RegistrationNewBook,
                         DeleteBookShop, DeleteGenre, AccountAllView,
                         AccountDeleteView, CommentDeleteView)

urlpatterns = [
    path('', GenreListView.as_view(), name='home'),
    path('delete_genre/', DeleteGenre.as_view(), name='delete_genre'),
    path('genre/<slug>/', GenreDetailView.as_view(), name='genre-detail'),
    path('user_account/<user>/',
         UserAccountView.as_view(),
         name='account-view'),
    path('<genre>/<slug>/', BookDetailView.as_view(), name='book-detail'),
    path('add_comment/', CreateCommentView.as_view(), name='add_comment'),
    path('user_likes/', UserLikesView.as_view(), name='user_likes'),
    path('books/', BookListView.as_view(), name='books'),
    path('info/', InfoView.as_view(), name='info'),
    path('registration/', RegistrationView.as_view(), name='registration'),
    path('login/', LoginView.as_view(), name='login'),
    path('buy_book/', BuyBook.as_view(), name='buy_book'),
    path('delete_book/', DeleteBook.as_view(), name='delete_book'),
    path('logout/',
         LogoutView.as_view(next_page=reverse_lazy('home')),
         name='logout_view'),
    path('search', SearchView.as_view(), name='search'),
    path('new_genre/', RegistretionNewGenre.as_view(), name='new_genre'),
    path('new_book/', RegistrationNewBook.as_view(), name='new_book'),
    path('delete_book_shop/', DeleteBookShop.as_view(), name='del_book_shop'),
コード例 #9
0
from django.urls import path
from books.views import (
    BookListView,
    BookDetailView,
    BookCreateView,
    BookUpdateView,
)

app_name = "books"

urlpatterns = [
    path("", BookListView.as_view(), name="books"),
    path("create", BookCreateView.as_view(), name="book_create"),
    path("update/<int:pk>", BookUpdateView.as_view(), name="book_update"),
    path("<int:pk>", BookDetailView.as_view(), name="book_detail"),
]
コード例 #10
0
ファイル: urls.py プロジェクト: gothaur/book_list
from django.urls import path

from books.views import (
    AddBookView,
    BookDetailView,
    BookListView,
    ImportBookView,
    UpdateBookView,
)

app_name = 'books'
urlpatterns = [
    path('', BookListView.as_view(), name='book-list'),
    path('add/', AddBookView.as_view(), name='add-book'),
    path('detail/<int:book_id>/', BookDetailView.as_view(),
         name='book-detail'),
    path('edit/<int:book_id>/', UpdateBookView.as_view(), name='book-edit'),
    path('import/', ImportBookView.as_view(), name='import-book'),
]
コード例 #11
0
from django.views.decorators.cache import cache_page

app_name = 'books'

urlpatterns = [
    # Index
    path(
        '',
        # cache_page(60 * 30)(BookListView.as_view()),
        BookListView.as_view(),
        name='index'),

    # Book detail
    path('book/<int:pk>/',
         cache_page(60 * 30)(BookDetailView.as_view()),
         name='book_detail'),

    # Publishing house books
    path('publishing_house/<int:publ_house_id>/',
         cache_page(60 * 30)(PublishingHouseListView.as_view()),
         name='publ_house'),

    # Series books
    path('episode/<int:episode_id>/',
         cache_page(60 * 30)(SeriesListView.as_view()),
         name='episode'),

    # Authors books
    path('author/<int:author_id>/',
         cache_page(60 * 30)(AuthorsListView.as_view()),
コード例 #12
0
# urlpatterns = [
#     path('books', index, name='books.index'),
#     path('books/<int:pk>', show, name='books.show'),
#     path('books/<int:pk>/edit', edit, name='books.edit'),
#     path('books/create', create, name='books.create'),
#     path('books/search', search, name='books.search'),
# ]
from django.urls import path
from django.views.generic import TemplateView

from books.views import BooksListView, BookCreateView, BookDetailView, BookUpdateView, BookDeleteView, \
    CartView

urlpatterns = [
    path('books/', BooksListView.as_view(), name='books.index'),
    path('books/<int:pk>', BookDetailView.as_view(), name='books.show'),
    path('books/<int:pk>/edit', BookUpdateView.as_view(), name='books.edit'),
    path('books/<int:pk>/delete',
         BookDeleteView.as_view(),
         name='books.delete'),
    path('books/create', BookCreateView.as_view(), name='books.create'),
    path('user-login/',
         TemplateView.as_view(template_name="UserLogin.html"),
         name="user_login"),
    path('seller-login/',
         TemplateView.as_view(template_name="SellerLogin.html"),
         name="seller_login"),
    path('contact/',
         TemplateView.as_view(template_name="ContactPage.html"),
         name="contact"),
    # path('search/', SearchResultsView.as_view(), name='search_results'),
コード例 #13
0
ファイル: urls.py プロジェクト: pastme/4prototype
from django.urls import path
from books.views import BookCreate, BookDelete, BookUpdate, BookDetailView

urlpatterns = [
    path('book/<slug:slug>-<int:pk>/', BookDetailView.as_view(), name='book'),
    path('book/add/', BookCreate.as_view(), name='book-add'),
    path('book/update/<int:pk>/', BookUpdate.as_view(), name='book-update'),
    path('book/<int:pk>/delete/', BookDelete.as_view(), name='book-delete'),
]
コード例 #14
0
ファイル: urls.py プロジェクト: gurmessa/mybooks-django
from django.contrib import admin
from django.urls import path
from books.views import BookListView, BookDetailView, download_book

app_name = 'books'

urlpatterns = [
    path('', BookListView.as_view(), name='home'),
    path('<str:slug>', BookDetailView.as_view(), name='detail'),
    path('download-book/<str:slug>', download_book, name='download-book'),
]
コード例 #15
0
from django.urls import path

from books.views import (
    homepage,
    BookDetailView,
    BooksListView,
    books_import,
)

urlpatterns = [
    path('', homepage, name="homepage"),
    path('book/<int:pk>/', BookDetailView.as_view(), name='bookdetailview'),
    path('books/', BooksListView.as_view(), name='bookslist'),
    path('db/', books_import, name='booksimport'),
]
コード例 #16
0
from django.urls import path
from books.views import BookListView, BookDetailView, BookDeleteView


urlpatterns = [
    path('', BookListView.as_view(), name="books_list"),
    path('detail/<int:pk>', BookDetailView.as_view(), name="book_detail"),
    path('delete/<int:pk>', BookDeleteView.as_view(), name="book_delete"),
]
コード例 #17
0
ファイル: urls.py プロジェクト: aadideshpande/djangoLibrary
from django.urls import path, include
from users import views as user_views
from books import views as books_views
# this is provided by django for login and logout
from django.contrib.auth import views as auth_views

# for adding the roots for media url
from django.conf import settings
from django.conf.urls.static import static

from books.views import BookListView, BookDetailView, BookCreateView, BookUpdateView, BookDeleteView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', BookListView.as_view(), name='home'),
    path('book/<int:pk>', BookDetailView.as_view(), name='book-detail'),
    #path('book/<int:pk>', book_detail, name='book-detail'),
    path('book/<int:pk>/update', BookUpdateView.as_view(), name='book-update'),
    path('book/<int:pk>/delete', BookDeleteView.as_view(), name='book-delete'),
    path('book/new/', BookCreateView.as_view(), name='book-create'),
    #path('', user_views.home, name='home'),
    path('register/', user_views.register, name='register'),
    path('login/',
         auth_views.LoginView.as_view(template_name='login.html'),
         name='login'),
    path('logout/',
         auth_views.LogoutView.as_view(template_name='logout.html'),
         name='logout'),
    path('profile/', user_views.profile, name='profile'),
    path('search/', books_views.search, name='search'),
    path('favorite/<int:pk>', books_views.favorite_book, name='favorite_book'),
コード例 #18
0
from django.conf.urls import include, url
from books.views import  BookDetailView,  \
    DataFormView, AuthorDetailView, CategoryDetailView


urlpatterns = [


    url(r'^book/(?P<slug>[\w-]+)/$', BookDetailView.as_view(), name='detail_view'),
    #url(r'^detail/(?P<slug>[-\w]+)/$', BookDetailView.as_view(), name='detail_view'),   
    url(r'^author/(?P<slug>[\w-]+)/$', AuthorDetailView.as_view(), name='author_view'),
    url(r'^category/(?P<slug>[\w-]+)/$', CategoryDetailView.as_view(), name='book_category'),
    url(r'^data-upload/', DataFormView.as_view(), name='data_upload'), 
    
]