示例#1
0
from django.conf.urls import patterns, url
from nomadblog.views import PostList, PostDetail, PostsByCategoryList, CategoriesList


urlpatterns = patterns(
    '',
    url(r'^$', PostList.as_view(), name='post_list'),
    url(r'^categories/$', CategoriesList.as_view(), name='category_list'),
    url(r'^(?P<category_slug>[-\w]+)/$', PostsByCategoryList.as_view(), name='post_list_by_category'),
    url('^(?P<category_slug>[-\w]+)/(?P<slug>[-\w]+)/$', PostDetail.as_view(), name='post_detail'),
)
示例#2
0
from django.conf.urls import patterns, url
from nomadblog.views import PostList, PostDetail, PostsByCategoryList, CategoriesList


urlpatterns = patterns(
    'nomadblog.views',
    url(r'^$', PostList.as_view(), name='list_posts'),
    url('^(?P<category_slug>[-\w]+)/(?P<slug>[-\w]+)/$', PostDetail.as_view(), name='show_post'),
    url(r'^(?P<category_slug>[-\w]+)/$', PostsByCategoryList.as_view(), name='list_posts_by_category'),
    url(r'^categories/list/all/$', CategoriesList.as_view(), name='list_categories'),
)
示例#3
0
from django.conf.urls import patterns, url
from nomadblog.views import PostList, PostDetail, PostsByCategoryList, CategoriesList

urlpatterns = patterns(
    '',
    url(r'^$', PostList.as_view(), name='post_list'),
    url(r'^categories/$', CategoriesList.as_view(), name='category_list'),
    url(r'^(?P<category_slug>[-\w]+)/$',
        PostsByCategoryList.as_view(),
        name='post_list_by_category'),
    url('^(?P<category_slug>[-\w]+)/(?P<slug>[-\w]+)/$',
        PostDetail.as_view(),
        name='post_detail'),
)