示例#1
0
文件: urls.py 项目: ZijianHe/zhihu
from django.conf.urls import patterns, url, include

from ajax.decorator import ajaxable_login_required
from zhihu.views import (QuestionList, QuestionDetail, answer_detail_view, UserList, UserDetail,
                         discovery_view, following_list_view, user_home_view, root_url_redirect_view,
                         search_view)


# Application part
urlpatterns = patterns(
    '',
    url(r'^$', root_url_redirect_view, name='root_url_redirect'),
    url(r'^home/$', ajaxable_login_required(user_home_view), name='home_page'),
    url(r'^questions/$', QuestionList.as_view(), name='question_list'),
    url(r'^question/(?P<question_id>\d+)',
        include([
            url(r'^/$', QuestionDetail.as_view(), name='question_detail'),
            url(r'^/answer/(?P<answer_id>\d+)/$', answer_detail_view, name='answer_detail'),
        ])),
    url(r'^user/profile/(?P<user_id>\d+)',
        include([
            url(r'^/$', UserDetail.as_view(), name='user_detail'),
            url(r'^/following-info/$', following_list_view, name='following_info'),
        ])),
    url(r'^users/$', UserList.as_view(), name='user_list'),
    url(r'^discovery/$', discovery_view, name='discovery_view'),
    url(r'^search$', search_view, name='search_view'),
)