예제 #1
0
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
from blog.views import PostList, PostDetail, PostCreate, PostEdit, PostDelete
from django.contrib.auth.decorators import login_required

urlpatterns = patterns(
    '',
    # Examples:
    # url(r'^$', 'amazing_blog.views.home', name='home'),
    # url(r'^amazing_blog/', include('amazing_blog.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls)),
    url(r'post/create$',
        login_required(PostCreate.as_view()),
        name='post_create'),
    url(r'post/(?P<pk>\d+)/edit$',
        login_required(PostEdit.as_view()),
        name='post_edit'),
    url(r'post/(?P<pk>\d+)/delete$',
        login_required(PostDelete.as_view()),
        name='post_delete'),
    url(r'post/(?P<pk>\d+)/$', PostDetail.as_view(), name='post_detail'),
    url(r'^tinymce/', include('tinymce.urls')),
    url(r'^$', PostList.as_view(), name='post_list'),
)
예제 #2
0
from django.conf.urls import patterns, include, url

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
from blog.views import PostList, PostDetail, PostCreate, PostEdit, PostDelete
from django.contrib.auth.decorators import login_required

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'amazing_blog.views.home', name='home'),
    # url(r'^amazing_blog/', include('amazing_blog.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls)),

    url(r'post/create$', login_required(PostCreate.as_view()), name='post_create'),
    url(r'post/(?P<pk>\d+)/edit$', login_required(PostEdit.as_view()), name='post_edit'),
    url(r'post/(?P<pk>\d+)/delete$', login_required(PostDelete.as_view()), name='post_delete'),
    url(r'post/(?P<pk>\d+)/$', PostDetail.as_view(), name='post_detail'),
    url(r'^tinymce/', include('tinymce.urls')),

    url(r'^$', PostList.as_view(), name='post_list'),
)
예제 #3
0
from django.conf.urls import url
from django.conf.urls.static import static

from blog.views import BookList, AddComment, AddLike, PostTemplateView, PostEdit, PostDetailsView, CommentEdit, \
    CommentDelete, TagView, PostCategoryView, CategoryView

urlpatterns = [
    # url(r'^page/(?P<page>\d+)/$', PrivatePostList.as_view()),
    url(r'^$', BookList.as_view(context_object_name='posts'),
        name='post_list'),
    # url(r'^(?:(?P<page>\d+)/)?$', BookList.as_view(context_object_name='posts'), name='post_list'),
    url(r'^post/(?P<pk>[0-9]+)/$',
        PostDetailsView.as_view(),
        name='post_detail'),
    url(r'^post/new/$', PostTemplateView.as_view(), name='post_new'),
    url(r'^post/(?P<pk>[0-9]+)/edit/$', PostEdit.as_view(), name='post_edit'),
    url(r'^post/add_like/(?P<post_id>\d+)/$',
        AddLike.as_view(),
        name='post_like'),
    url(r'^post_detail/addcomment/(?P<post_id>\d+)/$',
        AddComment.as_view(),
        name='post_comment'),
    url(r'^post_detail/(?P<pk>\d+)/edit_comment/(?P<id>\d+)/$',
        CommentEdit.as_view(),
        name='edit_comment'),
    url(r'^post_detail/(?P<pk>\d+)/delete_comment/(?P<id>\d+)/$',
        CommentDelete.as_view(),
        name='delete_comment'),
    url(r'^category/(?P<id>.*)/$', PostCategoryView.as_view(),
        name='category'),
    url(r'^post/(?P<pk>[0-9]+)/category/(?P<id>.*)/$',
예제 #4
0
파일: urls.py 프로젝트: natecox/bixly-blog
# URLs from the blog app, prefixed with blog.views
urlpatterns = patterns('blog.views',
    # Main page (index). Displays all posts in default order.
    url(r'^$', 'posts'),
    # Date filtering url. Accepts named arguments for year and month. Month is optional.
    url(r'^date/(?P<year>\d+)/(?P<month>\d+)?/?$', 'posts'),
    # Filter by tag name
    url(r'^tag/(?P<tag>\d+)/$', 'posts'),
    # Individual posts
    url(r'^post/(?P<post>\d+)/$', 'single_post'),
    # Search posts
    url(r'^search/', 'posts'),
    # Add a new post
    url(r'^add/$', PostCreate.as_view()),
    url(r'^edit/(?P<pk>\d+)/$', PostEdit.as_view()),
    url(r'^delete/(?P<pk>\d+)/$', PostDelete.as_view()),
    # Handle Ajax request for recaptcha
    url(r'^recaptcha/$', 'verify_recaptcha'),
)

# URL for authentication
urlpatterns += patterns(
    '',
    url(r'^accounts/login/$', login),
    url(r'^accounts/logout/$', logout, {'next_page': '/'}),
)

# URL for the admin app.
urlpatterns += patterns (
    '',