Пример #1
0
from app.views import \
        PostList, PostDetail, \
        CategoryList, CategoryDetail, \
        AuthorList, AuthorDetail
from django.urls import path

app_name = 'app'
urlpatterns = [
    path('', PostList.as_view(), name='post-list'),
    path('<int:pk>', PostDetail.as_view(), name='post-detail'),
    path('categories/', CategoryList.as_view(), name='category-list'),
    path('categories/<int:pk>',
         CategoryDetail.as_view(),
         name='category-detail'),
    path('authors/', AuthorList.as_view(), name='author-list'),
    path('authors/<int:pk>', AuthorDetail.as_view(), name='author-detail'),
]
Пример #2
0
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 app.views import CategoryList, SubCategoryList, ProductSubCategoryList, ProductCategoryList, InsertProduct

urlpatterns = [
    url(r'^category/', CategoryList.as_view()),  #API to get all categories 
    url(r'^subcategory/',
        SubCategoryList),  #API to get subcategories for a category 
    url(r'^products/',
        ProductSubCategoryList),  #API to get all products for a subcategory 
    url(r'^products_cat/',
        ProductCategoryList),  #API to get all products for a category 
    url(r'^products_insert/', InsertProduct
        ),  #API to post new product under existing subcategory and category
    url(r'^admin/', admin.site.urls),
]
Пример #3
0
from app.views import PostList, PostDetail, CategoryList, CategoryDetail, AuthorList, AuthorDetail, AlbumList
from django.urls import path  

app_name = 'app'  
urlpatterns = [  
    path('', PostList.as_view(), name='post-list'),  
    path('<int:pk>', PostDetail.as_view(), name='post-detail'),
    path('category', CategoryList.as_view(), name='cat-list'),
    path('category/<int:pk>', CategoryDetail.as_view(), name='cat-detail'),
    path('author', AuthorList.as_view(), name='auth-list'),
    path('author/<int:pk>', AuthorDetail.as_view(), name='auth-detail'),
    path('album', AlbumList.as_view(), name='al-list'),    
]
Пример #4
0
from app.views import PostList, PostDetail, CategoryList, CategoryDetail
from django.urls import path

app_name = 'app'
urlpatterns = [
    path('', PostList.as_view(), name='post-list'),
    path('<int:pk>', PostDetail.as_view(), name='post-detail'),
    path('categories/', CategoryList.as_view(), name='category-detail'),
    path('categories/<int:pk>',
         CategoryDetail.as_view(),
         name='category-detail'),
]
Пример #5
0
from app.views import PostList
from django.urls import path
from app.views import PostList, PostDetail
from app.views import CategoryList, CategoryDetail, index

app_name = 'app'
urlpatterns = [
    path('posts/', PostList.as_view(), name='post-list'),
    path('posts/<int:pk>', PostDetail.as_view(), name='post-detail'),
    path('categories/', CategoryList.as_view(), name='categories-list'), # все категории
    path('categories/<int:pk>', CategoryDetail.as_view(), name='categories-detail'), # единичная категория
]
Пример #6
0
from app.views import PostList, PostDetail, CategoryList, CategoryDetail
from django.urls import path

app_name = 'app'
urlpatterns = [
    path('', PostList.as_view(), name='post-list'),
    path('<int:pk>', PostDetail.as_view(), name='post-detail'),
    path('categories', CategoryList.as_view(), name='CategoryList'),
    path('categories/<int:pk>',
         CategoryDetail.as_view(),
         name='CategoryDetail')
]