Esempio n. 1
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-list'),
    path('categories/<int:pk>', CategoryDetail.as_view(), name='category-detail'),
]
Esempio n. 2
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'),
]
Esempio n. 3
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'), # единичная категория
]