예제 #1
0
    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 webapp.views import ArticleListView, ArticleDetailView, CommentCreateView, CommentUpdateView, UserListView, UserDetailView, FavoritListView, ArticleCreateView, ArticleUpdateView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', ArticleListView.as_view(), name='article_list'),
    path('articles/<int:pk>',
         ArticleDetailView.as_view(),
         name='article_detail'),
    path('users', UserListView.as_view(), name='user_list'),
    path('users/<int:pk>', UserDetailView.as_view(), name='user_detail'),
    path('users/<int:pk>/favorites',
         FavoritListView.as_view(),
         name='user_favorit'),
    path('articles/create', ArticleCreateView.as_view(),
         name='article_create'),
    path('articles/<int:pk>/update',
         ArticleUpdateView.as_view(),
         name='article_update'),
    path('comment/create', CommentCreateView.as_view(), name='comment_create'),
    path('comment/<int:pk>/update',
         CommentUpdateView.as_view(),
         name='comment_update'),
]
예제 #2
0
                      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(),
예제 #3
0
    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 webapp.views import IndexView, ArticleView, ArticleCreateView, \
    ArticleUpdateView, ArticleDeleteView, CommentCreateView, CommentForArticleCreateView, \
    CommentListView, CommentUpdateView, CommentDeleteView,ArticleSearchView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', IndexView.as_view(), name='index'),
    path('article/search/', ArticleSearchView.as_view(),
         name='article_search'),
    path('article/<int:pk>/', ArticleView.as_view(), name='article_view'),
    path('article/add/', ArticleCreateView.as_view(), name='article_add'),
    path('article/<int:pk>/edit/',
         ArticleUpdateView.as_view(),
         name='article_update'),
    path('article/<int:pk>/delete/',
         ArticleDeleteView.as_view(),
         name='article_delete'),
    path('comments/', CommentListView.as_view(), name='comment_list'),
    path('comment/add/', CommentCreateView.as_view(), name='comment_add'),
    path('comment/<int:pk>/edit/',
         CommentUpdateView.as_view(),
         name='comment_update'),
    path('comment/<int:pk>/delete/',
         CommentDeleteView.as_view(),
         name='comment_delete'),
    path('article/<int:pk>/add-comment/',
    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 webapp.views import ArticlesListView, ArticleDetailView, UsersListView, UserDetailView, FavoritesListView, \
    ArticleCreateView, ArticleUpdateView, CommentCreateView, CommentEditView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', ArticlesListView.as_view(), name='articles_list'),
    path('article/<int:pk>',
         ArticleDetailView.as_view(),
         name='article_detail'),
    path('users/', UsersListView.as_view(), name='users_list'),
    path('user/<int:pk>', UserDetailView.as_view(), name='user_detail'),
    path('user/<int:pk>/favorites',
         FavoritesListView.as_view(),
         name='favorites_list'),
    path('article/create', ArticleCreateView.as_view(), name='create_article'),
    path('article/<int:pk>/update',
         ArticleUpdateView.as_view(),
         name='edit_article'),
    path('article/comment/create',
         CommentCreateView.as_view(),
         name='create_comment'),
    path('comment/<int:pk>/edit',
         CommentEditView.as_view(),
         name='edit_comment'),
]