コード例 #1
0
ファイル: urls.py プロジェクト: Artur1303/Homework_hello
                    path('unlike',
                         ArticleUnlikeView.as_view(),
                         name='article_unlike')
                ])),
            path('add/', ArticleCreateView.as_view(), name='article_create'),
            path('mass-action/',
                 ArticleMassActionView.as_view(),
                 name='article_mass_action'),
        ])),
    path(
        'comment/',
        include([
            path(
                '<int:pk>/',
                include([
                    path('update/',
                         CommentUpdateView.as_view(),
                         name='comment_update'),
                    path('delete/',
                         CommentDeleteView.as_view(),
                         name='comment_delete'),
                    path('like',
                         CommentLikeView.as_view(),
                         name='comment_like'),
                    path('unlike',
                         CommentUnlikeView.as_view(),
                         name='comment_unlike')
                ]))
        ]))
]
コード例 #2
0
app_name = 'webapp'

urlpatterns = [
    path('', IndexView.as_view(), name='index'),

    path('article/', include([
        path('<int:pk>/', include([
            path('', ArticleView.as_view(), name='article_view'),
            path('update/', ArticleUpdateView.as_view(), name='article_update'),
            path('delete/', ArticleDeleteView.as_view(), name='article_delete'),
            path('comments/add/', ArticleCommentCreateView.as_view(),
                 name='article_comment_add'),
            path('like/', ArticleLikeView.as_view(), name='article_like'),
            path('unlike/', ArticleUnLikeView.as_view(), name='article_unlike'),
        ])),

        path('add/', ArticleCreateView.as_view(), name='article_create'),
        path('mass-action/', ArticleMassActionView.as_view(), name='article_mass_action'),
    ])),

    path('comment/', include([
        path('<int:pk>/', include([
            path('update/', CommentUpdateView.as_view(), name='comment_update'),
            path('delete/', CommentDeleteView.as_view(), name='comment_delete'),
            path('like/', CommentLikeView.as_view(), name='comment_like'),
            path('unlike/', CommentUnLikeView.as_view(), name='comment_unlike')
        ]))
    ]))
]