示例#1
0
文件: urls.py 项目: reg3x/pyblog
)

urlpatterns = patterns(
    "",
    # Index
    url(regex=r"^(?P<page>\d+)?/?$", view=BaseView.as_view(), name="home"),
    # Individual posts
    url(
        regex=r"^(?P<pub_date__year>\d{4})/(?P<pub_date__month>\d{1,2})/(?P<slug>[a-zA-Z0-9-]+)/?$",
        view=SingleView.as_view(),
        name="post",
    ),
    # Categories
    url(regex=r"^category/(?P<slug>[a-zA-Z0-9-]+)/?$", view=CategoryListView.as_view(), name="category"),
    # Tags
    url(regex=r"^tag/(?P<slug>[a-zA-Z0-9-]+)/?$", view=TagListView.as_view(), name="tag"),
    # Post RSS feed
    url(regex=r"^feeds/posts/$", view=PostsFeed()),
    # Log in
    url(regex=r"^login/$", view="django.contrib.auth.views.login"),
    # Log out
    url(regex=r"^logout/$", view="django.contrib.auth.views.logout", kwargs={"next_page": "home"}),
    # Dashboard
    url(regex=r"^dashboard/$", view=DashBoardView.as_view(), name="dashboard"),
    # Add Post
    url(regex=r"^post/add/$", view=AddPost.as_view(), name="addpost"),
    # Update Post
    url(regex=r"^post/update/(?P<slug>[a-zA-Z0-9-]+)?$", view=UpdatePost.as_view(), name="updatepost"),
    # Delete Post
    url(regex=r"^post/delete/(?P<slug>[a-zA-Z0-9-]+)?$", view=DeletePost.as_view(), name="deletepost"),
)
示例#2
0
urlpatterns = [
    # Index Blog
    url(r'^(?P<page>\d+)?/?$',
     PostListView.as_view(
        paginate_by=7
        ), name = 'post_list'),       # Generic ListView

    # Individual posts
    url(r'^(?P<pub_date__year>\d{4})/(?P<pub_date__month>\d{1,2})/(?P<slug>[a-zA-Z0-9-]+)/?$',
     DetailView.as_view()),

    # Categories
    url(r'^category/(?P<slug>[a-zA-Z0-9-]+)/?$',
     CategoryListView.as_view(
        paginate_by=5,
        model=Category,
        )),

    # Tags
    url(r'^tag/(?P<slug>[a-zA-Z0-9-]+)/?$',
     TagListView.as_view(
        paginate_by=5,
        model=Tag,
        )),

    # Posts RSS feed
    url(r'^feeds/posts/$', PostsFeed()),

]
示例#3
0
from django.views.generic import ListView, DetailView
from blogengine.models import Post, Category, Tag
from blogengine.views import CategoryListView, TagListView, PostsFeed

urlpatterns = patterns('',
    # Index
    url(r'^(?P<page>\d+)?/?$', ListView.as_view(
        model=Post,
        paginate_by=5,
        )),

    # Individual posts
    url(r'^(?P<pub_date__year>\d{4})/(?P<pub_date__month>\d{1,2})/(?P<slug>[a-zA-Z0-9-]+)/?$', DetailView.as_view(
        model=Post,
        )),

    # categories
    url(r'^category/(?P<slug>[a-zA-Z0-9]+)/?$', CategoryListView.as_view(
    	model=Category,
    	paginate_by=5, 
    	)),

    # tags
    url(r'^tag/(?P<slug>[a-zA-Z0-9]+)/?$', TagListView.as_view(
        model=Tag,
        paginate_by=5, 
        )),

    # post RSS feed
    url(r'^feeds/posts/$', PostsFeed()),
)
示例#4
0
文件: urls.py 项目: daniel924/MyBlog
urlpatterns = patterns('',
    # Index
    url('^$', ListView.as_view(
        model=Post,
        paginate_by=5,
        )),

     # Individual posts
     url(r'^(?P<pub_date__year>\d{4})/(?P<pub_date__month>\d{1,2})/(?P<slug>[a-zA-Z0-9-]+)/?$', DetailView.as_view(
        model=Post,
        )),

     # Categories
     url(r'^category/(?P<slug>[a-zA-Z0-9-]+)/?$', CategoryListView.as_view(
       paginate_by=5,
       model=Category,
     )),

     # Tags
     url(r'tag/(?P<slug>[a-zA-Z0-9-]+)/?$', TagListView.as_view(
       paginate_by=5,
       model=Tag,
       )),
    
    # Media
    url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
    'document_root': settings.MEDIA_ROOT}),

    url(r'^admin/', include(admin.site.urls)),
)
示例#5
0
from django.conf.urls import patterns,url
from django.views.generic import ListView,DetailView
from blogengine.models import Post,Category, Tag
from blogengine.views import CategoryListView, TagListView, PostsFeed

urlpatterns = patterns('',
    url(r'^$',ListView.as_view(
        model=Post,
        paginate_by=5,
    )),

    url(r'^(?P<pub_date__year>\d{4})/(?P<pub_date__month>\d{1,2})/(?P<slug>[a-zA-Z0-9-]+)/?$',DetailView.as_view(
        model=Post,
    )),

    url(r'^category/(?P<slug>[a-zA-Z0-9-]+)/?$',CategoryListView.as_view(
        paginate_by = 5,
        model = Category,
    )),

    url(r'^tag/(?P<slug>[a-zA-Z0-9-]+)/?$',TagListView.as_view(
        paginate_by=5,
        model = Tag,
    )),

    url(r'^feeds/posts/?$',PostsFeed()),
)
示例#6
0
    url(r'^(?P<pub_date__year>\d{4})/(?P<pub_date__month>\d{1,2})/(?P<slug>[a-zA-Z0-9-]+)/?$',
        DetailView.as_view(model=Post, ),
        name='post'),

    # Categories
    url(r'^category/(?P<slug>[a-zA-Z0-9-]+)/?$',
        CategoryListView.as_view(
            model=Category,
            paginate_by=5,
        ),
        name='category'),

    # Tags
    url(r'^tag/(?P<slug>[a-zA-Z0-9-]+)/?$',
        TagListView.as_view(
            model=Tag,
            paginate_by=5,
        ),
        name='tag'),

    # Post RSS feed
    url(r'^feeds/posts/$', PostsFeed()),

    # Search posts
    url(r'^search', getSearchResults, name='search'),

    # Archive post
    url(r'^archive/?$', posts_archive, name="post_archive"),

    # Category post
    url(r'^categories/?$', posts_category, name="post_category"),
]
from django.conf.urls import patterns, url
from django.views.generic import ListView, DetailView
from blogengine.models import Category, Post, Tag
from blogengine.views import CategoryListView, TagListView, PostsFeed

urlpatterns = patterns('',
    # Index
    url(r'^(?P<page>\d+)?/?$',
        ListView.as_view(model=Post, paginate_by=5)),

    # Individual post
    url(r'^(?P<pub_date__year>\d{4})/(?P<pub_date__month>\d{1,2})/(?P<slug>[a-zA-Z0-9-]+)/?$',
        DetailView.as_view(model=Post)),

    # Categories
    url(r'^category/(?P<slug>[a-zA-Z0-9-]+)/?$',
        CategoryListView.as_view(model=Category, paginate_by=5)),

    # Tags
    url(r'^tag/(?P<slug>[a-zA-Z0-9-]+)/?$',
        TagListView.as_view(model=Tag, paginate_by=5)),

    # Posts feed
    url(r'^feeds/posts/$', PostsFeed())
)
示例#8
0
    url(r'^(?P<pub_date__year>\d{4})/(?P<pub_date__month>\d{1,2})/(?P<pub_date__day>\d{1,2})/(?P<slug>[a-zA-Z0-9-]+)/?$',
        DetailView.as_view(model=Post, ),
        name='post'),

    # Categories
    url(r'^category/(?P<slug>[a-zA-Z0-9-]+)/?$',
        CategoryListView.as_view(
            paginate_by=5,
            model=Category,
        ),
        name='category'),

    # Tags
    url(r'^tag/(?P<slug>[a-zA-Z0-9-]+)/?$',
        TagListView.as_view(
            paginate_by=5,
            model=Tag,
        ),
        name='tag'),

    # Post RSS feed
    url(r'^feeds/posts/$', PostsFeed()),

    # Category RSS feed
    url(r'^feeds/posts/category/(?P<slug>[a-zA-Z0-9-]+)/?$',
        CategoryPostsFeed()),

    # Tag RSS feed
    url(r'^feeds/posts/tag/(?P<slug>[a-zA-Z0-9-]+)/?$', TagPostsFeed()),

    # Search posts
    url(r'^search', getSearchResults, name='search'),
示例#9
0
文件: urls.py 项目: ah3200/travelblog
from django.conf.urls import url, include
from django.views.generic import ListView, DetailView
from blogengine.models import Story, Category, Tag
from blogengine.views import CategoryListView, TagListView, StoriesFeed, CategoryStoriesFeed, TagStoriesFeed
from blogengine import views

urlpatterns = [
    url(r'^story/(?P<page>\d+)?/?$', ListView.as_view(model=Story, paginate_by=2)),
    url(r'^story/(?P<pub_date__year>\d{4})/(?P<pub_date__month>\d{1,2})/(?P<slug>[a-zA-Z0-9-]+)/?$', DetailView.as_view(
        model=Story,
        )),
    url(r'^category/(?P<slug>[a-zA-Z0-9-]+)/(?P<page>\d+)?/?$', CategoryListView.as_view(model=Category, paginate_by=2)),
    url(r'^tag/(?P<slug>[a-zA-Z0-9-]+)/(?P<page>\d+)?/?$', TagListView.as_view(model=Tag, paginate_by=2), name='tag-view'),
    # Post RSS feed
    url(r'^feeds/stories/$', StoriesFeed()),
    # Category RSS feed
    url(r'^feeds/stories/category/(?P<slug>[a-zA-Z0-9-]+)/?$', CategoryStoriesFeed()),
    # Tag RSS feed
    url(r'^feeds/stories/tag/(?P<slug>[a-zA-Z0-9-]+)/?$', TagStoriesFeed()),
    # Search stories
    url(r'^search', views.getSearchResults),
    url(r'^story/new/$', views.createNewStory),
    url(r'^api/', include('api.urls')),
    ]
示例#10
0
     ),

    # Index Blog - Posts List
    re_path(r'^(?P<page>\d+)?/?$',
     PostListView.as_view(
        paginate_by=7
        ), name = 'post_list'),       # Generic ListView

    # Individual posts - Post Detail
    re_path(r'^(?P<pub_date__year>\d{4})/(?P<pub_date__month>\d{1,2})/(?P<slug>[a-zA-Z0-9-]+)/?$',
     DetailView.as_view()),

    # Categories - Posts List by Category
    path(r'category/<slug:slug>/',
     CategoryListView.as_view(
        paginate_by=5,
        model=Category,
        ), name = 'category_list'),

    # Tags - Posts List by Tag
    path(r'tag/<slug:slug>/',
     TagListView.as_view(
        paginate_by=5,
        model=Tag,
        ), name = 'tag_list'),

    # Posts RSS feed
    path('feeds/posts/', PostsFeed()),

]