示例#1
0
from django.views.decorators.cache import cache_page

urlpatterns = [

    ####################  REGISTRATION/ ADMIN/ LOGIN ##########
    url('', include('social.apps.django_app.urls', namespace='social')),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^', include('django.contrib.auth.urls')),
    url(r'^$', StateList.as_view(), name="home"),
    url(r'^register/', CreateUser.as_view(), name='register'),

    ####################  SHARED (anyone can access) ##########
    url(r'^posts/search$', 'fredslist.views.search', name='post_search'),
    url(r'^posts/(?P<pk>\d+)/$', PostDetail.as_view(), name='post_detail'),
    url(r'^top_posts/',
        cache_page(50)(TopPostList.as_view()),
        name="top_post_list"),
    url(r'^cityposts/(?P<pk>\d+)/$', PostList.as_view(), name="post_list"),
    # url(r'^posts/(?P<subcategory>\w+)/(?P<city>\w+)/$', PostList.as_view(), name="post_list"),
    # url(r'^posts/(?P<city>(\d+))/(?P<sub_category>(\d+))/$', PostList.as_view(), name="post_list"),
    url(r'^(?P<pk>\d+)/$', CityDetail.as_view(), name='city_detail'),

    ####################  FREDSLIST ADMIN ##########
    url(r'^home/', login_required(MyPostList.as_view()), name='home_page'),
    url(r'^create_post/$',
        login_required(CreatePost.as_view()),
        name='post_create'),
    url(r'^update_post/(?P<pk>\d+)',
        login_required(EditPost.as_view()),
        name='post_edit'),
    url(r'^delete_post/(?P<pk>\d+)',
示例#2
0
from rest_framework.authtoken import views
from django.views.decorators.cache import cache_page


urlpatterns = [
    ####################  REGISTRATION/ ADMIN/ LOGIN ##########
    url("", include("social.apps.django_app.urls", namespace="social")),
    url(r"^admin/", include(admin.site.urls)),
    url(r"^", include("django.contrib.auth.urls")),
    url(r"^$", StateList.as_view(), name="home"),
    url(r"^register/", CreateUser.as_view(), name="register"),
    ####################  SHARED (anyone can access) ##########
    url(r"^posts/search$", "fredslist.views.search", name="post_search"),
    url(r"^posts/(?P<pk>\d+)/$", PostDetail.as_view(), name="post_detail"),
    url(r"^top_posts/", cache_page(50)(TopPostList.as_view()), name="top_post_list"),
    url(r"^cityposts/(?P<pk>\d+)/$", PostList.as_view(), name="post_list"),
    # url(r'^posts/(?P<subcategory>\w+)/(?P<city>\w+)/$', PostList.as_view(), name="post_list"),
    # url(r'^posts/(?P<city>(\d+))/(?P<sub_category>(\d+))/$', PostList.as_view(), name="post_list"),
    url(r"^(?P<pk>\d+)/$", CityDetail.as_view(), name="city_detail"),
    ####################  FREDSLIST ADMIN ##########
    url(r"^home/", login_required(MyPostList.as_view()), name="home_page"),
    url(r"^create_post/$", login_required(CreatePost.as_view()), name="post_create"),
    url(r"^update_post/(?P<pk>\d+)", login_required(EditPost.as_view()), name="post_edit"),
    url(r"^delete_post/(?P<pk>\d+)", login_required(DeletePost.as_view()), name="post_delete"),
    ####################  API ##########
    # url(r'^api/(?P<pk>\d+)$', APIDetailUpdateState.as_view(), name='api_state_detail_update'),
    # url(r'^api/$', APIListCreateState.as_view(), name='api_state_list_create'),
    url(r"^api/(?P<pk>\d+)$", APIDetailUpdatePost.as_view(), name="api_post_detail_update"),
    url(r"^api/$", APIListCreatePost.as_view(), name="api_post_list_create"),
    url(r"^api/top_posts/$", APIListTopPosts.as_view(), name="api_top_post_list"),
示例#3
0


urlpatterns = [

    ####################  REGISTRATION/ ADMIN/ LOGIN ##########
    url(r'^admin/', include(admin.site.urls)),
    url(r'^', include('django.contrib.auth.urls')),
    url(r'^$', StateList.as_view(), name="home"),
    url(r'^register/', CreateUser.as_view(), name='register'),


    ####################  SHARED (anyone can access) ##########
    url(r'^posts/search$', 'fredslist.views.search',name='post_search'),
    url(r'^posts/(?P<pk>\d+)/$', PostDetail.as_view(),name='post_detail'),
    url(r'^top_posts/', TopPostList.as_view(), name="top_post_list"),
    url(r'^posts/', PostList.as_view(), name="post_list"),
    url(r'^city/(?P<pk>\d+)/$', CityDetail.as_view(),name='city_detail'),


    ####################  FREDSLIST ADMIN ##########
    url(r'^home/', MyPostList.as_view(), name='home_page'),
    url(r'^create_post/$', login_required(CreatePost.as_view()), name='post_create'),
    url(r'^update_post/(?P<pk>\d+)', login_required(EditPost.as_view()), name='post_edit'),
    url(r'^delete_post/(?P<pk>\d+)', login_required(DeletePost.as_view()), name='post_delete'),


    ####################  API ##########
    # url(r'^api/(?P<pk>\d+)$', APIDetailUpdateState.as_view(), name='api_state_detail_update'),
    # url(r'^api/$', APIListCreateState.as_view(), name='api_state_list_create'),
    url(r'^api/(?P<pk>\d+)$', APIDetailUpdatePost.as_view(), name='api_post_detail_update'),