from django.conf.urls import patterns, url, include from library import views from library.views import PublisherList, PublisherDetail, BookList, PublisherBookList from library.views import MultipleView, ContactListView, ContactDetailView, contact_detail_with_comments urlpatterns = patterns( "", url(r"^books/(?P<name>\S+)$", PublisherBookList.as_view(), name="booklist"), # Multiple object views ############################################################# url(r"^all/$", MultipleView.as_view(), name="multiple_view"), url(r"^publishers/$", PublisherList.as_view()), url(r"^publishers/$", BookList.as_view()), url(r"^publishers/(?P<pk>\d+)$", PublisherDetail.as_view()), # testing forms class based views ################################################### url(r"^contact/$", ContactListView.as_view(), name="contact_list"), # testing forms function based views ################################################ url(r"^contact/(?P<pk>\d+)$", views.contact_detail_with_comments, name="contact_detail_with_comments"), )
"""CRUD URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.1/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 library.views import BookList, BookDetail urlpatterns = [ path('book/', BookList.as_view()), path('book/<int:pk>', BookDetail.as_view()), path('admin/', admin.site.urls), ]
# -*- coding: utf-8 -*- """ Created on Thu Oct 15 23:36:18 2015 @author: HP-PC """ from django.conf.urls import url from library.views import BookList from . import views urlpatterns = [ url(r'^$',views.get_name,name = 'get_name'), url(r'^welcome/(?P<username>\D+)/$' , views.welcome, name='welcome'), url(r'^register/$',views.register,name = 'register'), url(r'^pickordering/(?P<username>\D+)/$',views.pick_order,name = 'pickorder'), url(r'^books/(\D+)$', BookList.as_view(), name='book_list'), url(r'^getbooks/(?P<user_name>\D+)/(?P<book_title>\D+)/(?P<no_of_copies>\d+)$',views.borrow_books,name = 'borrow_books'), ]
"""CRUDapi URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.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 from library.views import BookList,BookDetail urlpatterns = [ path('api/books',BookList.as_view()), path('api/books/<int:pk>',BookDetail.as_view()), path('admin/', admin.site.urls), ]
from django.urls import path from library.views import BookList, BookDetail, AuthorList, AuthorDetail from . import views urlpatterns = [ path('author/', AuthorList.as_view(), name = 'author'), path('author/<int:pk>/', AuthorDetail.as_view(), name = 'author-detail'), path('book/', BookList.as_view(), name= 'book'), path('title/', views.title, name='title'), path('title/<int:title_id>/', views.title_detail, name='title_detail') ]