Esempio n. 1
0
    'post' : BlogPostSitemap,
    'pages': FlatPageSitemap
}

urlpatterns = patterns('',
                       #Index
                       url(r'^(?P<page>\d+)?/?$',
                           ListView.as_view(model=BlogPost, paginate_by=5),
                           name="index"),
                       #Detail views
                       url(r'^(?P<post_datetime__year>\d{4})/(?P<post_datetime__month>\d{1,2})/(?P<slug>[a-zA-Z0-9-]+)/?$',
                           DetailView.as_view(model=BlogPost),
                           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()),
                       #Search result
                       url(r'^search', 'blog.views.get_search_result', name="search"),

                       #Sitemap
                       url(r'^sitemap\.xml', sitemap, {'sitemap': sitemaps} ,
Esempio n. 2
0
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Add an import:  from blog import urls as blog_urls
    2. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import patterns, include, url
from django.contrib import admin
from blog.views import CategoryListView, TagListView
from blog.models import Category, Tag

admin.autodiscover()

urlpatterns = patterns('',
    url(r'^admin', include(admin.site.urls)),
    url(r'^blog/$', 'blog.views.index'),
    url(r'^blog/(?P<slug>[\w\-]+)/$', 'blog.views.post'),
    url(r'^$', 'landing.views.index'),
    url(r'^search', 'blog.views.getSearchResults'),
    url(r'^categories/(?P<slug>[a-zA-Z0-9-]+)/?$', CategoryListView.as_view(
        paginate_by=5,
        model=Category,
        )),
    url(r'^tags/(?P<slug>[a-zA-Z0-9-]+)/?$', TagListView.as_view(
        paginate_by=5,
        model=Tag,
        )),
)
Esempio n. 3
0
from django.views.decorators.cache import cache_page

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

from blog.views import (IndexView, CategoryListView, TagsListView,
                        PostDetailView, PageDetailView)
from feeds import LatestEntriesFeed
from sitemap import PostSitemap

urlpatterns = patterns('',
    url(r'^$', IndexView.as_view(), name='home'),

    url(r'^feed|rss/$', LatestEntriesFeed()),
    url(r'^sitemap\.xml$', cache_page(sitemap_views.sitemap, 60 * 60 * 12), {'sitemaps': {'posts': PostSitemap}}),

    url(r'^category/(?P<alias>\w+)/', CategoryListView.as_view()),
    url(r'^tag/(?P<tag>[\w|\.|\-]+)/$', TagsListView.as_view()),

    url(r'^admin/', include(admin.site.urls), name='admin'),

    url(r'^xmlrpc/$', 'django_xmlrpc.views.handle_xmlrpc', {}, 'xmlrpc'),

    #放到最后
    url(r'^(?P<slug>[\w|\-|\d|\W]+?).html$', PostDetailView.as_view()),
    url(r'^(?P<slug>\w+)/$', PageDetailView.as_view()),
)

urlpatterns += staticfiles_urlpatterns()
Esempio n. 4
0
#coding: utf-8
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.conf import settings

from django.contrib import admin
admin.autodiscover()

from blog.views import IndexView, CategoryListView, PostDetailView

urlpatterns = patterns('',
	url(r'^admin/', include(admin.site.urls)),
	url(r'^$', IndexView.as_view(), name='home'),
	url(r'^category/(?P<slug>[-_\w]+)/$', CategoryListView.as_view(), name='category_list'),
	url(r'^article/(?P<slug>[-_\w]+)/$', PostDetailView.as_view(), name='post_detail'),
)

urlpatterns += patterns('blog.views',
	# url(r'^validate_input/$', 'validate_input'),
	url(r'^upload/$', 'upload'),
	url(r'^create_album/$', 'create_album'),
) 
# + static(r'^register/(?P<path>.*)$', document_root=settings.SITEPAGE_ROOT)

urlpatterns += patterns('',
	url(r'^register/(?P<path>.*)$','django.views.static.serve',\
		{'document_root': settings.SITEPAGE_ROOT}),
)
Esempio n. 5
0
    url(r'^$', IndexView.as_view()),
    url(r'^news/$',NewsView.as_view()),
    url(r'^post/(?P<pk>[0-9]+)$', PostView.as_view()),
    url(r'^news/(?P<pk>[0-9]+)$', News1View.as_view()),
    url(r'^comment/add/(?P<pk>[0-9]+)$', CommentView.as_view()),
    url(r'^comment/delete/(?P<pk>[0-9]+)$', CommentDeleteView.as_view()),
    url(r'^repository$', RepositoryView.as_view()),
    url(r'^repository/(?P<pk>[0-9]+)$', RepositoryDetailView.as_view()),
    url(r'^tag/(?P<slug>[\w\u4e00-\u9fa5]+)$', TagListView.as_view()),
    url(r'^catalogue/(?P<slug>[0-9]+)$', CatalogueListView.as_view()),
    url(r'^author/(?P<pk>[0-9]+)$', AuthorPostListView.as_view()),
    url(r'^test/$',emtest_view,name='sp'),
    url(r'^change_sc/$',change_view,name='ch'),
    url(r'^blog/report/(?P<pk>[0-9]+)$',report_view.as_view()),
    url(r'^author1/(?P<pk>[0-9]+)$', AuthorNewsListView.as_view()),#新闻归档
    url(r'^category/(?P<pk>[0-9]+)$', CategoryListView.as_view()),
    url(r'^add/collect/(?P<pk>[0-9]+)$',CollectView.as_view()),
# 123456
    url(r'^register/$',register_views),
    # url(r'captcha/$', verifycode),
    url(r'ceshi/$',register_views),
    url(r'tiaozhuan/$',ceshi),
    url(r'agreement/$',show_Agreement),
    url(r'aboutus/$',show_aboutUs),
    url(r'contact/$',contact_us),
    # url(r'^change_sc_done/$',change_view_done,name='chd'),
    #####
    url(r'^recommend/(?P<pk>[0-9]+)$', RecommendView.as_view()),
    url(r'^search/(?P<pk>.+)$', SearchView.as_view(), name='search'),# 新增
    url(r'^history/(?P<pk>[0-9]+)$',HistoryView.as_view()),#查看历史文章
	url(r'^tags/$', TagsView.as_view()),
Esempio n. 6
0
The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
# blog/urls.py

from django.urls import path

from blog.views import IndexView, PostDetailView, CategoryListView, TagListView, CategoryPostView, TagPostView, SearchPostView

app_name = 'blog'
urlpatterns = [
    path('', IndexView.as_view(), name='index'),
    path('post/<int:pk>/', PostDetailView.as_view(), name='post_detail'),
    path('categories/', CategoryListView.as_view(), name='category_list'),
    path('tags/', TagListView.as_view(), name='tag_list'),
    path('category/<str:category_slug>/',
         CategoryPostView.as_view(),
         name='category_post'),
    path('tag/<str:tag_slug>/', TagPostView.as_view(), name='tag_post'),
    path('search/', SearchPostView.as_view(), name='search_post'),
]
Esempio n. 7
0
File: urls.py Progetto: Jwpe/jw.pe
            context_object_name="posts"), name="blog_index"),
    #Returns one blog post (based on slug)
    url(r'^post/(?P<slug>[-\w]+)/$',
        DetailView.as_view(model=Post, context_object_name="post"),
        name="blog_detail"),
    #Returns the blog posts for a certain day
    url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{1,2})/$',
        DayArchiveView.as_view(model=Post, paginate_by=5,
            context_object_name="posts", month_format='%m',
            date_field='publish'), name="blog_archive_day"),
    #Returns the blog posts for a certain month
    url(r'^(?P<year>\d{4})/(?P<month>\d{2})/$',
        MonthArchiveView.as_view(model=Post, paginate_by=5,
            context_object_name="posts", month_format='%m',
            date_field='publish', allow_empty=True),
        name="blog_archive_month"),
    #Returns the blog posts for a certain year
    url(r'^(?P<year>\d{4})/$',
        YearArchiveView.as_view(model=Post, date_field='publish',
            allow_empty=True), name="blog_archive_year"),
    #Returns the blog posts for a certain category
    url(r'^categories/(?P<slug>[-\w]+)/$',
        CategoryListView.as_view(allow_empty=True, paginate_by=5),
        name="category_detail"),
    #RSS URL
    url(r'rss/$', LatestEntriesFeed()),
    # Draft post URL
    url(r'^{}/'.format(settings.DRAFT_POST_URL), process_draft_post,
        name='process_draft_post'),
)
Esempio n. 8
0
from django.conf.urls import patterns, include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

from django.contrib import admin
from blog.models import Article
admin.autodiscover()

from blog.views import (IndexView, DetailViews, CategoryListView, TagListView)

urlpatterns = patterns(
    '',
    url(r'^admin/', include(admin.site.urls)),
    url(r'^$', IndexView.as_view(template_name='index.html')),
    url(r'^detail/(?P<slug>.*)$',
        DetailViews.as_view(model=Article, template_name='detail.html')),
    url(r'^category/(?P<alias>.*)/$',
        CategoryListView.as_view(template_name='index.html')),
    url(r'^tag/(?P<tag>.*)/$',
        TagListView.as_view(template_name='index.html')),
)
urlpatterns += staticfiles_urlpatterns()
Esempio n. 9
0
sitemaps = {
    'posts': PostSitemap,
    'pages': FlatpageSitemap
}

urlpatterns = [
    # Index
    url(r'^$', views.index, name="index"),

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

    # Comments
    #url(r'^comments/', include('fluent_comments.urls')),

    # Archive Views
    url(r'^archives/$', PostAllView.as_view(), name="post_all_archive"),
    url(r'^archives/(?P<year>[0-9]{4})/$', PostYearArchiveView.as_view(), name="post_year_archive"),
    url(r'^archives/(?P<year>[0-9]{4})/(?P<month>[0-9]+)/$', PostMonthArchiveView.as_view(month_format='%m'), name="post_month_archive"),

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

    # Post RSS feed
    url(r'^feed/$', feeds.LatestPosts()),

    # Sitemap
    url(r'^sitemap\.xml$', sitemap, {'sitemaps': sitemaps},
            name='django.contrib.sitemaps.views.sitemap'),
]
Esempio n. 10
0
from django.conf.urls import url

from blog.views import IndexView, PostView, CommentView, RepositoryView, RepositoryDetailView, TagListView, \
    CategoryListView, AuthorPostListView, CommentDeleteView

urlpatterns = [
    url(r'^$', IndexView.as_view()),
    url(r'^post/(?P<pk>[0-9]+)$', PostView.as_view()),
    url(r'^comment/add/(?P<pk>[0-9]+)$', CommentView.as_view()),
    url(r'^comment/delete/(?P<pk>[0-9]+)$', CommentDeleteView.as_view()),
    url(r'^repository$', RepositoryView.as_view()),
    url(r'^repository/(?P<pk>[0-9]+)$', RepositoryDetailView.as_view()),
    url(r'^tag/(?P<slug>[\w\u4e00-\u9fa5]+)$', TagListView.as_view()),
    url(r'^category/(?P<slug>[\w\u4e00-\u9fa5]+)$', CategoryListView.as_view()),
    url(r'^author/(?P<pk>[0-9]+)$', AuthorPostListView.as_view())
]
Esempio n. 11
0
from django.contrib import admin
from django.urls import path
from blog.views import ItemsByCategoryView, CategoryListView, ItemDetailView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', CategoryListView.as_view(), name='category-list'),
    path('<str:slug>/',
         ItemsByCategoryView.as_view(),
         name='items-by-category'),
    path('item/<str:slug>/', ItemDetailView.as_view(), name='item-detail'),
]
Esempio n. 12
0
from blog.views import CategoryListView
from books.views import BookListView
from gesfi.views import *

urlpatterns = [
    url(r'^admin/', include(admin.site.urls)),

    #### Blog #######
#    url(r'^$', 'blog.views.index'),
    url(r'^genres/$', 'blog.views.show_genres'),
    url(r'^blog/', 'blog.views.post_list'),
    url(r'^meta/', 'blog.views.display_meta'),
    url(r'^time/$', 'blog.views.current_datetime'),
    url(r'^time/plus/(\d{1,2})/$', 'blog.views.hours_ahead'),
    url(r'^products/$', CategoryListView.as_view()),
    url(r'^some_view/$','blog.views.some_view'),

    #### Books #######
#    url(r'^search-form/$', 'books.views.search_form'),
    url(r'^search/$', 'books.views.search'),
    url(r'^contact/$', 'books.views.contact'),
    url(r'^books/$', BookListView.as_view()),

    #### GesFi #######
    url(r'^$', 'gesfi.views.main_page'),
    url(r'^user/(\w+)/$', user_page),
    url(r'^transactions/(\w+)/$', transactions_page),
    url(r'^login/$', 'django.contrib.auth.views.login'),
    url(r'^logout/$', logout_page),
Esempio n. 13
0
from django.urls import path
from . import views
from django.contrib.auth import views as auth_views
from django.views.generic import TemplateView
from blog.views import AboutMe_TemplateView, PostDetailView, PostListView, CategoryListView
#namespace = 'blog'

urlpatterns = [
    path('about_me/', AboutMe_TemplateView.as_view(), name='aboutme'),
    path('', PostListView.as_view(), name="post_list"),
    path('<category>/', CategoryListView.as_view(), name="post_category"),
    path('post/<int:pk>/', PostDetailView.as_view(), name="post_detail"),
    path('programmming/',
         views.post_category_programming,
         name='post_category_programming'),
    path('cooking/', views.post_category_cooking,
         name='post_category_cooking'),
    path('post/new/', views.post_new, name='post_new'),
    path('post/<int:pk>/edit/', views.post_edit, name='post_edit'),
    path('post/<int:pk>/delete/', views.post_delete, name='post_delete'),
    path('login/',
         auth_views.LoginView.as_view(template_name='login.html'),
         name='login'),
]
Esempio n. 14
0
from django.conf.urls import url, include
from blog.views import PostListView, PostDetailView, CategoryDetailView, CategoryListView, PostCreateView, \
    CategoryCreateView

__author__ = 'k1'

urlpatterns = [
    url(r'^$', PostListView.as_view(), name='post_list'),
    url(r'^post/(?P<pk>\d+)/$', PostDetailView.as_view(), name='post_detail'),
    url(r'^post/create/$', PostCreateView.as_view(), name='post_create'),
    # url(r'^comments/', include('django.contrib.comments.urls')),
    url(r'^categories/$', CategoryListView.as_view(), name='category_list'),
    url(r'^category/(?P<pk>\d+)/$', CategoryDetailView.as_view(), name='category_detail'),
    url(r'^category/create/$', CategoryCreateView.as_view(), name='category_create'),
]
Esempio n. 15
0
from django.conf.urls import patterns, include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

from django.contrib import admin
from blog.models import Article

admin.autodiscover()

from blog.views import IndexView, DetailViews, CategoryListView, TagListView

urlpatterns = patterns(
    "",
    url(r"^admin/", include(admin.site.urls)),
    url(r"^$", IndexView.as_view(template_name="index.html")),
    url(r"^detail/(?P<slug>.*)$", DetailViews.as_view(model=Article, template_name="detail.html")),
    url(r"^category/(?P<alias>.*)/$", CategoryListView.as_view(template_name="index.html")),
    url(r"^tag/(?P<tag>.*)/$", TagListView.as_view(template_name="index.html")),
)
urlpatterns += staticfiles_urlpatterns()
Esempio n. 16
0
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Add an import:  from blog import urls as blog_urls
    2. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import patterns, include, url
from django.contrib import admin
from blog.views import CategoryListView, TagListView
from blog.models import Category, Tag

admin.autodiscover()

urlpatterns = patterns(
    '',
    url(r'^admin', include(admin.site.urls)),
    url(r'^blog/$', 'blog.views.index'),
    url(r'^blog/(?P<slug>[\w\-]+)/$', 'blog.views.post'),
    url(r'^$', 'landing.views.index'),
    url(r'^search', 'blog.views.getSearchResults'),
    url(r'^categories/(?P<slug>[a-zA-Z0-9-]+)/?$',
        CategoryListView.as_view(
            paginate_by=5,
            model=Category,
        )),
    url(r'^tags/(?P<slug>[a-zA-Z0-9-]+)/?$',
        TagListView.as_view(
            paginate_by=5,
            model=Tag,
        )),
)
Esempio n. 17
0
from django.conf.urls import url

from blog.views import IndexView, PostView, CommentView, RepositoryView, RepositoryDetailView, TagListView, \
    CategoryListView, AuthorPostListView, CommentDeleteView

urlpatterns = [
    url(r'^$', IndexView.as_view()),
    url(r'^post/(?P<pk>[0-9]+)$', PostView.as_view()),
    url(r'^comment/add/(?P<pk>[0-9]+)$', CommentView.as_view()),
    url(r'^comment/delete/(?P<pk>[0-9]+)$', CommentDeleteView.as_view()),
    url(r'^repository$', RepositoryView.as_view()),
    url(r'^repository/(?P<pk>[0-9]+)$', RepositoryDetailView.as_view()),
    url(r'^tag/(?P<slug>[\w\u4e00-\u9fa5]+)$', TagListView.as_view()),
    url(r'^category/(?P<slug>[\w\u4e00-\u9fa5]+)$',
        CategoryListView.as_view()),
    url(r'^author/(?P<pk>[0-9]+)$', AuthorPostListView.as_view())
]
Esempio n. 18
0
from django.views.generic import ListView, DetailView
from blog.models import Post, Category, Tag
from blog.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(
        paginate_by=5,
        model=Category,
        )),

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

    # Post RSS feed
    url(r'^feeds/posts/$', PostsFeed()),
)
Esempio n. 19
0
from django.conf.urls import patterns, url
from django.views.generic import ListView, DetailView
from blog.models import Category, Post, Tag
from blog.views import CategoryListView, TagListView, PostsFeed

urlpatterns = patterns(
    "blog.views",
    # 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(paginate_by=5, model=Category)),
    # Tags
    url(r"^tag/(?P<slug>[a-zA-Z0-9-]+)/?$", TagListView.as_view(paginate_by=5, model=Tag)),
    # Post RSS feed
    url(r"^feeds/posts/$", PostsFeed()),
)
Esempio n. 20
0
from django.conf.urls import patterns, url
from blog.views import BlogListView, EntriesMonthArchiveView, EntriesYearArchiveView, BlogDetailView, CategoryListView
urlpatterns = patterns('',
#        url(r'(?P<pk>[0-9]+)/$', BlogDetail.as_view()),
#        url(r'^$', BlogList.as_view()),
#        url(r'categories/', CategoryList.as_view()),
        url(r'^$', BlogListView.as_view(), name="blogindex"),
        url(r'^(?P<year>\d{4})/$', EntriesYearArchiveView.as_view()),
        url(r'^(?P<year>\d{4})/(?P<month>[-\w]+)/$', EntriesMonthArchiveView.as_view()),
        url(r'^(?P<slug>[-\w]+)/$', BlogDetailView.as_view(), name='entry'),
        url(r'^category/(?P<slug>[-\w]+)/$', CategoryListView.as_view()),
        )