from django.conf.urls import url from board.views import BoardSearchView, PostCreateView, PostListView, PostBestListView, PostListByCategoryView urlpatterns = [ url(r'^$', PostListView.as_view(), name='board_post_list'), url(r'^best/$', PostBestListView.as_view(), name='board_post_list_best'), url(r'^c/(?P<category>\w+)/$', PostListByCategoryView.as_view(), name='board_post_list_by_category'), url(r'^search', BoardSearchView.as_view(), name='board_search'), url(r'^newpost/$', PostCreateView.as_view(), name='board_post_create'), ]
from django.conf.urls import patterns, url from board.views import BoardSearchView, PostCreateView, PostListView, PostBestListView, PostListByCategoryView urlpatterns = patterns( '', url(r'^$', PostListView.as_view(), name='board_post_list'), url(r'^best/$', PostBestListView.as_view(), name='board_post_list_best'), url(r'^c/(?P<category>\w+)/$', PostListByCategoryView.as_view(), name='board_post_list_by_category'), url(r'^search', BoardSearchView.as_view(), name='board_search'), url(r'^newpost/$', PostCreateView.as_view(), name='board_post_create'), )
from django.conf.urls import patterns, url from board.views import PostDetailView, PostListView, PostUpdateView, PostCreateView, TopicListView, HomeTopicListView urlpatterns = patterns( '', url(r'^$', TopicListView.as_view(), name='board_post_list'), url(r'^home/$', HomeTopicListView.as_view(), name='board_home_post_list'), url(r'^(?P<pk>\d+)/single/$', PostDetailView.as_view(single=True), name='board_post_view_single'), url(r'^(?P<pk>\d+)/$', PostDetailView.as_view(), name='board_post_view'), url(r'^(?P<pk>\d+)/edit/$', PostUpdateView.as_view(), name='board_post_save'), url(r'^new/$', PostCreateView.as_view(), name='board_post_save'), )
# -*- encoding: utf8 -*- from django.conf.urls import patterns, url from django.contrib.auth.decorators import login_required from board.views import list_posts, show_post_detail, PostCreateView, CommentCreateView # 条件によってルーティングを切り替える def dispatch_by_login(request, *args, **kwargs): if request.user.is_authenticated(): view = CommentCreateView.as_view() else: view = show_post_detail return view(request, *args, **kwargs) urlpatterns = patterns('', url(r'^$', list_posts, name='home'), url(r'^add$', login_required(PostCreateView.as_view()), name='add_new_post'), url(r'^(?P<pk>\d+)$', dispatch_by_login, name='show_post_detail'), )