示例#1
0
文件: urls.py 项目: Atala/blog_app
# -*- coding: utf-8 -*-

from django.conf.urls import patterns, include, url
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
from django.views.generic import TemplateView
from views import PostDetail, PostList, MonthView, CitationList, ContactView
from models import Entry, Category, Citation 


urlpatterns = patterns('blog.views',
    # Examples:
    url(r'^$', PostList.as_view() , name='home'),
    url(r'^posts/(?P<slug>[a-zA-Z0-9_-]+)/$', PostDetail.as_view(model=Entry), name='post'),
    url(r'^posts/(?P<year>\d+)/(?P<month>\d+)/$', MonthView.as_view(model=Entry), name='month'),
    url(r'^category/(?P<slug>[a-zA-Z0-9_]+)/$', PostList.as_view(), name='category'),
    url(r'^citations/$', CitationList.as_view(), name='citation'),
    url(r'^contact/$', ContactView.as_view(), name = 'contact'),
    url(r'^email_successful$', TemplateView.as_view(template_name='contact_success.html'), name = 'contact_success'),    
    # 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)),
)

if settings.DEBUG :    
    urlpatterns += patterns('',(r'^media/(?P<path>.*)$', 'django.views.static.serve',
	    {'document_root': settings.MEDIA_ROOT}),)
示例#2
0
from django.conf.urls import url
from django.contrib.auth.decorators import login_required

from views import BlogListView, BlogView, PostDetail, CreateBlog
from views import UpdateBlog, CreatePost, UpdatePost, PostLikeAjaxView
from views import PostLikeCount, CommentsPostView

urlpatterns = [
    url(r'^$', BlogListView.as_view(), name='blog_list'),
    url(r'^(?P<pk>\d+)/$', BlogView.as_view(), name='blog'),
    url(r'^add_blog$', login_required(CreateBlog.as_view()), name='add_blog'),
    url(r'^edit_blog/(?P<pk>\d+)',
        login_required(UpdateBlog.as_view()),
        name='edit_blog'),
    url(r'^add_post', login_required(CreatePost.as_view()), name='add_post'),
    url(r'^edit_post/(?P<pk>\d+)',
        login_required(UpdatePost.as_view()),
        name='edit_post'),
    url(r'post/(?P<pk>\d+)/comments$',
        CommentsPostView.as_view(),
        name='post_comments'),
    url(r'post/(?P<pk>\d+)/likes$',
        PostLikeAjaxView.as_view(),
        name='post_ajax_like'),
    url(r'post/(?P<pk>\d+)$', PostDetail.as_view(), name='post'),
    url(r'post/likes$', PostLikeCount.as_view(), name='likecount'),
]
示例#3
0
from django.conf.urls import patterns, url
from views import PostListing, PostCreate, PostDetail, PostUpdate, PostDelete


urlpatterns = patterns('post',
    url(r'^$', PostListing.as_view(), name='listing'),
    url(r'^create/$', PostCreate.as_view(), name='create'),
    url(r'^(?P<pk>\d+)/$', PostDetail.as_view(), name='detail'),
    url(r'^(?P<pk>\d+)/update/$', PostUpdate.as_view(), name='update'),
    url(r'^(?P<pk>\d+)/delete/$', PostDelete.as_view(), name='delete'),
)
示例#4
0
文件: urls.py 项目: SirBigG/la_reine
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from . import views
from views import ItemsList, PostsList, PostDetail


urlpatterns = [
    url(r'^$', views.index, name = 'index'),
    url(r'^items/', ItemsList.as_view() , name = 'items'),
    url(r'^posts/', PostsList.as_view() , name='posts'),
    url(r'^post/(?P<pk>\d+)/$', PostDetail.as_view() , name = 'post'),
    url(r'^feedback/', views.feedback, name = 'feedback'),
    url(r'feedback_valid/', views.feedback_valid, name = 'feedback_valid'),
    url(r'^put_to_basket/(?P<item_id>\d+)/$', views.put_to_basket, name = 'put_to_basket'),
    url(r'^basket/', views.basket, name = 'basket'),
    url(r'^del_from_basket/(?P<id>\d+)/$', views.del_from_basket, name = 'del_from_basket'),
    url(r'^empty_basket/', views.empty_basket, name='empty_basket'),
    url(r'^sale/' , views.sale, name = 'sale'),

] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
示例#5
0
from django.conf.urls.defaults import *
from django.views.generic import ListView
from django.views.generic import DateDetailView

from models import Post

from views import PostList, PostDetail


post_list = url(
    regex  = '^$',
    view   = PostList.as_view(),    
    name   = 'post_list'
)

post_detail = url(
    regex  = '^(?P<year>\d{4})/(?P<month>[0-9]{2})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
    view   = PostDetail.as_view(),
    name   = 'post_detail'
)

urlpatterns = patterns('',
  post_list,
  post_detail,
  # archive_day,
  # archive_month,
  # archive_year
)