コード例 #1
0
ファイル: booklist.py プロジェクト: tanvidhope/BookShop
def list_books(request, **kwargs):
    if request.method=='GET':
        query_set_json = BookList().get(request)
        print (query_set_json)
        return HttpResponse(query_set_json)
        #return render(request,'book.html',{'booklist':query_set_json})
    else:
        pass
コード例 #2
0
ファイル: tests.py プロジェクト: FilipHalon/bookshelf-wise
class BookListViewTestCase(RequestFactoryTests):
    c = Client()
    url = "/books/"
    filter_params = [
        "title__icontains",
        "publication_lang",
        "author",
        "from_date",
        "to_date",
    ]

    def setUp(self):
        super().setUp()
        self.view = BookList()
        self.view.setup(self.req)

    def test_context_object_name_books(self):
        self.assertIn("books", self.view.context_object_name)
コード例 #3
0
ファイル: urls.py プロジェクト: andsko1/practice
from orders.views import CustomersList, CustomerDetails
from books.views import BookList, AuthorList, BooksDetail, AuthorsDetail
from django.contrib.auth.views import logout
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    url(r'^log/(?P<path>.*)$', 'papages.views.listing'),
    url(r'^$', 'papages.views.home'),
    #url(r'^library/$', 'books.views.books'),	
    #url(r'^library/books/$', 'books.views.books'),
    #url(r'^library/books/(?P<book>\d+)/$', 'books.views.book'),
    #url(r'^library/authors/$', 'books.views.authors'),
    #url(r'^library/authors/(?P<author>\d+)/$', 'books.views.author'),
    url(r'^library/$', BookList.as_view()),
    url(r'^library/books/$', BookList.as_view()),
    url(r'^library/books/(?P<pk>\d+)$', BooksDetail.as_view()),
    url(r'^library/authors/(?P<pk>\d+)$', AuthorsDetail.as_view()),
    url(r'^library/authors/$', AuthorList.as_view()),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^orders/$', CustomersList.as_view()),
    url(r'^orders/(?P<pk>\d+)/$', CustomerDetails.as_view(template_name='orders/customer.html')),
    url(r'^library/search/$', 'search.views.search'),
    url(r'^login/$', 'registry.views.login'),
    url(r'^auth/$', 'registry.views.authentication'),
    url(r'^register/$', 'registry.views.registration'),
    url(r'^logout/$', logout),
    # Examples:
    # url(r'^$', 'mysite.views.home', name='home'),
    # url(r'^mysite/', include('mysite.foo.urls')),
コード例 #4
0
ファイル: urls.py プロジェクト: katrinamariehh/tfa_prototype
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.contrib.auth import views as auth_views
from books.views import BookList, AuthorList

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'tfa_prototype.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),
    url(r'', include('two_factor.urls', 'two_factor')),
    url(r'^logout/$', auth_views.logout, name='logout'),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^books/', BookList.as_view()),
    url(r'^authors/', AuthorList.as_view()),
)
コード例 #5
0
ファイル: urls.py プロジェクト: liddyv/RestfulAPI
from django.conf.urls import url
from books.views import BookList, BookDetail

urlpatterns = [
    url(
        r'^books$',
        BookList.as_view()
    ),
    url(
        r'^books/(?P<pk>[0-9]+)$',
        BookDetail.as_view()
    )
]
コード例 #6
0
from django.conf.urls import url
from books.views import BookList, BookDetail, CommentList, CommentDetail, RatingCreate

urlpatterns = [
    url(r'^books$', BookList.as_view(), name=BookList.name),
    url(r'^books/(?P<pk>[0-9]+)$', BookDetail.as_view(), name=BookDetail.name),
    url(r'^comments$', CommentList.as_view(), name=CommentList.name),
    url(r'^comments/(?P<pk>[0-9]+)$',
        CommentDetail.as_view(),
        name=CommentDetail.name),
    url(r'^ratings$', RatingCreate.as_view())
]
コード例 #7
0
from django.conf.urls import url
from books.views import BookList, BookDetail

urlpatterns = [
    url(r'^books$', BookList.as_view()),
    url(r'^books/(?P<pk>[0-9]+)$', BookDetail.as_view())
]
コード例 #8
0
ファイル: urls.py プロジェクト: des0ps/etsmtl-log210
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
from django.conf.urls import url
from django.contrib import admin

import accounts.urls
import coop.urls
import coop.views
import sales.urls

from books.views import BookList
from log210.views import About
from log210.views import Index

urlpatterns = [
    url(r"^$", Index.as_view(), name="index"),
    #    Includes
    url(r"^admin/", include(admin.site.urls)),
    url(r"^accounts/", include(accounts.urls)),
    url(r"^coop/", include(coop.urls)),
    url(r"^sales/", include(sales.urls)),
    #    Navbar
    url(r"^about$", About.as_view(), name="about"),
    url(r"^books/search=$", BookList.as_view(), {"q": ""}, name="book-list"),
    url(r"^books/search=(?P<q>.+)$", BookList.as_view(), name="book-list"),
]
コード例 #9
0
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, re_path

from books.views import (
    BookList,
    BookCreateUpdate,
    GoogleBookAPISearch,
    BookAPIList,
    index,
)

urlpatterns = [
    path("", index, name="index"),
    path("admin/", admin.site.urls),
    re_path(r"^books", BookList.as_view(), name="browse"),
    re_path(r"^update/(?P<pk>\d+)?", BookCreateUpdate.as_view(), name="create-update"),
    path("expand", GoogleBookAPISearch.as_view(), name="expand"),
    path("api/books", BookAPIList.as_view(), name="api"),
]
コード例 #10
0
ファイル: urls.py プロジェクト: mcridednb/skillfactory-tests
from django.urls import path

from books.views import BookList, BookDetail

urlpatterns = [
    path("", BookList.as_view(), name="book-list"),
    path("<int:pk>", BookDetail.as_view(), name="book-detail"),
]
コード例 #11
0
ファイル: urls.py プロジェクト: freetiger/mybook
# -*- coding: utf-8 -*-

from django.conf.urls import patterns
from books import views
from django.views.generic import TemplateView
from django.conf.urls import patterns, url
from books.views import PublisherList,PublisherBookList,BookList,AuthorDetailView,MyView
import django_databrowse

urlpatterns = patterns('',
    (r'^django_databrowse/(.*)', django_databrowse.site.root),
    (r'^filters_test$', views.filters_test),
    (r'^tags_test$', views.tags_test),
    (r'^about/', MyView.as_view()),
    url(r'^publishers/$', PublisherList.as_view()),
    (r'^books/$', BookList.as_view()),
    (r'^books/([\w-]+)/$', PublisherBookList.as_view()),
    url(r'^authors/(?P<pk>\d+)/$', AuthorDetailView.as_view(), name='author-detail'),
)


from books.models import Publisher, Author, Book
django_databrowse.site.register(Publisher)
django_databrowse.site.register(Author)
django_databrowse.site.register(Book)
コード例 #12
0
from django.urls import path, include
from django.contrib import admin
from books.views import BookView
from books.views import BookList, CreateBook, UpdateBook, DeleteBook

urlpatterns = [
    path('create_book/', CreateBook.as_view(), name='book-create'),
    path('book_list/', BookList.as_view(), name='book-detail-list'),
    path('<int:pk>/', BookView.as_view(), name='book-detail-view'),
    path('update_book/<int:pk>/', UpdateBook.as_view(), name='book-update'),
    path('delete_book/<int:pk>/', DeleteBook.as_view(), name='book-delete'),
]
コード例 #13
0
ファイル: urls.py プロジェクト: sunjzz/mysite
# -*- coding: utf-8 -*-
# @author ZhengZhong,Jiang
# @time 2017/6/13 0013 下午 16:14

from django.conf.urls import url, include
from django.contrib import admin
from books.views import SearchBookView, AcmeBookList, BookList
from books.views import search

urlpatterns = [
    url(r'^search/', SearchBookView.as_view(), name='search'),
    url(r'^booklist/', BookList.as_view(), name='booklist'),
    url(r'^acmelist/', AcmeBookList.as_view(), name='acmelist'),
    # url(r'^search', search)
]
コード例 #14
0
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.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include
from books.views import book_details, index, user_signup, profile_view, BookList, AuthorDetails, AuthorList
urlpatterns = [
    path('', index, name="index"),
    path('accounts/', include('django.contrib.auth.urls')),
    path('accounts/registration/', user_signup),
    path('accounts/profile/', profile_view, name="user_profile"),
    path('admin/', admin.site.urls),
    path('books/', BookList.as_view(), name="book_list"),
    path('authors/', AuthorList.as_view(), name="author_list"),
    path("authors/<int:author_id>",
         AuthorDetails.as_view(),
         name="author_details"),
    path('books/<int:book_id>', book_details, name="book_details"
         )  #gdy w GET po slash int następuje przypisanie do zmiennej book_id
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
コード例 #15
0
"""mirafra_books URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.11/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 django.http import HttpResponseRedirect
from books.views import dashboard, BorrowBook, BookList, BorrowList, return_book_date

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', dashboard),
    url(r'^borrow-book/$', BorrowBook.as_view()),
    url(r'^list-of-books/$', BookList.as_view()),
    url(r'^list-of-borrow_books/$', BorrowList.as_view()),
    url(r'^return-borrow-book/(?P<qid>.*)/$', return_book_date),
    url(r'.*css/bootstrap-cerulean.min.css$',
        lambda request: HttpResponseRedirect(
            '/static/charisma/css/bootstrap-cerulean.min.css')),
]
コード例 #16
0
ファイル: urls.py プロジェクト: geektousif/django-books
"""bookrev URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/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 django.conf import settings
from django.conf.urls.static import static
from books.views import BookList

urlpatterns = [
    path('', BookList.as_view(), name='home'),
    path('admin/', admin.site.urls),
    path('users/', include('django.contrib.auth.urls')),
    path('users/', include('users.urls'))
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
コード例 #17
0
ファイル: urls.py プロジェクト: CodingTemple/django-lectures
    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, include
from django.contrib import admin
from books.views import indexView, BookList, add_to_cart, cart, checkout, checkoutpost, braintreetoken, receipt
from userauth.views import user_login
urlpatterns = [
    url(r'^$', indexView.as_view(), name='index'),
    url(r'^admin/', admin.site.urls),
    url(r'^books/$', BookList.as_view(), name='Books'),
    url(r'^api-auth/',
        include('rest_framework.urls'),
        name='rest_framework_auth'),
    url(r'^api/v1/books/', include('books.urls'), name='Books_API_V1'),
    url(r'^userauth/', include('userauth.urls')),
    url(r'logout/$', include('userauth.urls'), name='logout'),
    url(r'^add/(?P<ISBN>[-\w]+)', add_to_cart, name='add_to_cart'),
    url(r'^checkout', checkout, name='checkout'),
    url(r'^postcheckout', checkoutpost, name='checkoutpost'),
    url(r'^braintreetoken/', braintreetoken, name='braintreetoken'),
    url(r'^receipt/', receipt, name='receipt'),
    #url(r'^remove/(?<ISBN>[-\w]+)', remove_from_cart, name="remove_from_cart"),
    url(r'^cart/', cart, name="cart"),
]
コード例 #18
0
"""untitled3 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 books.views import BookList, AddList, BookDelete, PutBook
urlpatterns = [
    path('admin/', admin.site.urls),
    path('booklist/', BookList.as_view()),
    path('addbook/', AddList.as_view()),
    path('delete/(?P<pk>[0-9]+)/$', BookDelete.as_view()),
    path('put/(?P<pk>[0-9]+)/$', PutBook.as_view()),
]
コード例 #19
0
ファイル: urls.py プロジェクト: arunthakur1993/booksapp
from django.conf.urls import url
from books.views import BookList, BookDelete
from . import views
from django.conf import settings
from django.conf.urls.static import static
from books.views import BookUpdate

urlpatterns = [
    url(r'^$', views.home, name='home'),
    url(r'^search/$', views.search_form, name='search'),
    url(r'^results/$', views.search_result, name='search_results'),
    url(r'^book/$', BookList.as_view(), name='book'),
    url(r'^update/$', views.get_name, name='get_name'),
    url(r'^upload/$', views.upload_file, name='upload'),
    # url books/book/3 starts from primary key 3
    url(r'^book/(?P<pk>[0-9]+)/$', BookUpdate.as_view(), name='book_update'),
    #url books/book/3/delete
    url(r'^book/(?P<pk>[0-9]+)/delete/$',
        BookDelete.as_view(),
        name='book_delete'),
]
コード例 #20
0
ファイル: urls.py プロジェクト: tmpbook/Class_based
from django.conf.urls import patterns, include, url
from books.views import PublisherList, BookList, PublisherBookList, AuthorDetailView, AuthorList
from books.views import AuthorCreate, AuthorUpdate, AuthorDelete

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'Class_based.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),

    url(r'^admin/', include(admin.site.urls)),
    url(r'^publishers/$', PublisherList.as_view(), name='publisher-list'),
    url(r'^books/$', BookList.as_view(), name='book-list'),
    url(r'^books/([\w-]+)/$', PublisherBookList.as_view(), name='book-detail'),
    url(r'^authors/$', AuthorList.as_view(), name='author-list'),
    url(r'^authors/(?P<pk>\d+)/$', AuthorDetailView.as_view(), name='author-detail'),
    url(r'^author/add/$', AuthorCreate.as_view(), name='author-create'),
    url(r'^author/(?P<pk>\d+)/$', AuthorUpdate.as_view(), name='author-update'),    
    url(r'^author/(?P<pk>\d+)/delete/$', AuthorDelete.as_view(), name='author-delete'),
)
コード例 #21
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()),
]

コード例 #22
0
ファイル: tests.py プロジェクト: FilipHalon/bookshelf-wise
 def setUp(self):
     super().setUp()
     self.view = BookList()
     self.view.setup(self.req)
コード例 #23
0
from django.urls import path

from books.views import BookList, AuthorList, BookDetails

urlpatterns = [
    path('', BookList.as_view(), name='book_list'),
    path('author/', AuthorList.as_view(), name='author_list'),
    path('<int:pk>/', BookDetails.as_view(), name='book_details'),
]
コード例 #24
0
ファイル: urls.py プロジェクト: dezhik74/books
from django.urls import path

from books.views import BookList, BookCreate, frontend

urlpatterns = [
    path('', frontend, name='frontend_url'),
    path('list', BookList.as_view(), name='books_list_url'),
    path('create', BookCreate.as_view(), name='books_list_url'),
]
コード例 #25
0
ファイル: urls.py プロジェクト: oliverroick/django-tests
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 url

from books.views import BookList, BookDetail


urlpatterns = [
    url(
        r'^books/$',
        BookList.as_view(),
        name='book_list'),
    url(
        r'^books/(?P<book_id>[0-9]+)/$',
        BookDetail.as_view(),
        name='book_detail'),

]