from django.conf.urls import url from blog.views import IndexView, DetailPostView, CategoryView, ArchivesView, ArchivesPost, CategotysPostView from blog.views import search urlpatterns = [ url(r'^$', IndexView.as_view(), name='index'), # 主页 url(r'^detail/(?P<pk>[0-9]+)/$', DetailPostView.as_view(), name='detail'), # 详情页 url(r'^category/(?P<pk>[0-9]+)/$', CategotysPostView.as_view(), name='category_post'), # 主页-分类 url(r'^archives/(?P<year>[0-9]{4})/(?P<month>[0-9]{1,2})/$', ArchivesPost.as_view(), name='archives_post'), # 主页-归档 url(r'^category$', CategoryView.as_view(), name='category'), # 分类 url(r'^archives$', ArchivesView.as_view(), name='archives'), # 归档 url(r'^search/$', search, name='search'), # 搜索 ]
__author__ = 'oldpan' __date__ = '2017/8/11 9:37' from django.conf.urls import url from blog.views import BlogView, ArticleView, ArchivesView, CategoryView, TagView app_name = 'blog' urlpatterns = [ url(r'^$', BlogView.as_view(), name='blog_page'), url(r'^post/(?P<pk>[0-9]+)/$', ArticleView.as_view(), name='article_page'), url(r'^archives/(?P<year>[0-9]{4})/(?P<month>[0-9]{1,2})/$', ArchivesView.as_view(), name='archives_page'), url(r'^category/(?P<pk>[0-9]+)/$', CategoryView.as_view(), name='category_page'), url(r'^tag/(?P<pk>[0-9]+)/$', TagView.as_view(), name='tag_page'), ]
from blog.views import ArchivesView, CategoryView, IncreaseLikeView, IndexPostListAPIView, IndexView, PostDetailView, PostViewSet, create_post, safe_delete_post, search, update_post from django.urls import path index = PostViewSet.as_view({'get': 'list'}) app_name = 'blog' urlpatterns = [ path('', IndexView.as_view(), name='index'), path('blogs/<int:pk>/', PostDetailView.as_view(), name='detail'), path('archives/<int:year>/<int:month>/', ArchivesView.as_view(), name='archives'), path('categories/<int:pk>/', CategoryView.as_view(), name='categories'), path('search/', search, name='search'), path('increase-likes/<int:id>/', IncreaseLikeView.as_view(), name='increase_likes'), path('create-post/', create_post, name='create_post'), path('delete-post/<int:id>/', safe_delete_post, name='post_safe_delete'), path('update/<int:id>/', update_post, name='update'), # path('api/index/', IndexPostListAPIView.as_view()), path('api/index/', index), ]