Esempio n. 1
0
File: urls.py Progetto: levylll/NGB
from django.conf.urls import url
from blog.views import IndexView,ArticleView,AllView,SearchView,ColumnView,UserView,NewsView,TagView,CategoryView
from django.views.generic import TemplateView,DetailView
from blog.models import News

urlpatterns = [
        url(r'^$',IndexView.as_view()),
        url(r'^article/(?P<slug>\w+).html$',ArticleView.as_view()),
        url(r'^all/$',AllView.as_view()),
        url(r'^search/$',SearchView.as_view()),
        url(r'^login/$',TemplateView.as_view(template_name="blog/login.html")),
        url(r'^register/$',TemplateView.as_view(template_name="blog/register.html")),
        url(r'^forgetpassword/$',TemplateView.as_view(template_name="blog/forgetpassword.html")),
        url(r'^resetpassword/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',TemplateView.as_view(template_name="blog/resetpassword.html")),
        url(r'^column/(?P<column>\w+)$',ColumnView.as_view()),
        url(r'^user/(?P<slug>\w+)$',UserView.as_view()),
        url(r'^news/$',NewsView.as_view()),
        url(r'^news/(?P<pk>\w+)$',DetailView.as_view(model=News)),
        url(r'^tag/(?P<tag>\w+)/$',TagView.as_view()),
        url(r'^category/(?P<category>\w+)/$',CategoryView.as_view()),
]
Esempio n. 2
0
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'))
"""
from django.contrib import admin
from django.urls import include, path
from .custom_site import custom_site
from django.conf.urls import url
from blog.views import IndexView, CategoryView, TagView, PostView
from blog import views

urlpatterns = [
    path('admin/', admin.site.urls),
    path('cus_admin/', custom_site.urls),
    path('tag/<int:tag_id>/', TagView.as_view(), name="tag"),
    path('post/', PostView.as_view(), name="post"),
    path('category/<int:category_id>/',
         CategoryView.as_view(),
         name="category"),

    #url(r'^admin/', admin.site.urls),
    #url(r'^cus_admin/', custom_site.urls),
    path('', views.IndexView.as_view(), name='home'),
    #url(r'^category/(?P<category_id>\d+)/', CategoryView.as_view(), name="category"),
    #url(r'^tag/(?P<tag_id>\d+)/$', TagView.as_view(), name="tag"),
    url(r'^post/(?P<pk>\d+)/$', PostView.as_view(), name="detail"),
]
Esempio n. 3
0
from config.views import LinkListView

router = DefaultRouter()
router.register(r'post', PostViewSet, basename='api-post')
router.register(r'category', CategoryViewSet, basename='api-category')

urlpatterns = [
    re_path(r'^$', IndexView.as_view(), name="index"),
    re_path(r'^links/$', LinkListView.as_view(), name="links"),
    re_path(
        r'^author/(?P<owner_id>\d+)/$', AuthorView.as_view(), name="author"),
    re_path(r'^search/$', SearchView.as_view(), name="search"),
    re_path(r'^category/(?P<category_id>\d+)/$',
            CategoryView.as_view(),
            name="category-list"),
    re_path(r'^tag/(?P<tag_id>\d+)/$', TagView.as_view(), name="tag-list"),
    re_path(r'^post/(?P<post_id>\d+)/$',
            PostDetailView.as_view(),
            name="post-detail"),
    re_path(r'^comment/$', CommentView.as_view(), name="comment"),
    re_path(r'^rss|feed/$', LatestPostFeed(), name="rss"),
    re_path(r'^sitemap\.xml$', sitemap_views.sitemap,
            {'sitemaps': {
                'posts': PostSitemap
            }}),
    re_path(r'^ckeditor/', include('ckeditor_uploader.urls')),
    # re_path(r'^api/post/', post_list, name="post-list"),
    # re_path(r'^api/post/', PostList.as_view(), name="post-list"),
    re_path(r'^api/', include(router.urls)),
    re_path(r'^super_admin/', admin.site.urls, name="super-admin"),
    re_path(r'^admin/', custom_site.urls, name="admin"),
Esempio n. 4
0
from django.contrib import admin
from django.urls import path, re_path, include
from django.conf.urls.static import static
from django.conf import settings
from django.views import static

from blog.views import Index, Friends, Detail, Archive, CategoryList, CategoryView, TagList, TagView, About

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', Index.as_view(), name='index'),
    path('friends/', Friends.as_view(), name='friends'),
    path('mdeditor/', include('mdeditor.urls')),
    path("article/", Archive.as_view(), name='archive'),
    path('article/<int:pk>', Detail.as_view(), name='detail'),
    path('category/', CategoryList.as_view(), name='category'),
    path('category/<int:pk>', CategoryView.as_view(), name='article_category'),
    path('tag/', TagList.as_view(), name='tag'),
    path('tag/<int:pk>', TagView.as_view(), name='article_tag'),
    path('about/', About.as_view(), name='about'),
    re_path(r'^static/(?P<path>.*)$',
            static.serve, {'document_root': settings.STATIC_ROOT},
            name='static')
]

admin.site.site_header = 'Mi Primer Blog'
admin.site.site_title = 'Django Blog app'

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)
Esempio n. 5
0
from django.urls import path

from blog import views
from blog.views import IndexView, ArchivesView, CategoryView, PostDetailView, TagView

app_name = 'blog'
urlpatterns = [
    path('', IndexView.as_view(), name='index'),
    path('post/<int:pk>/', PostDetailView.as_view(), name='detail'),
    path('archives/<int:year>/<int:month>/',
         ArchivesView.as_view(),
         name='archives'),
    path('category/<int:pk>/', CategoryView.as_view(), name='categories'),
    path('tag/<int:pk>/', TagView.as_view(), name='tag'),
    # path('search/', views.search, name='search'),
]
Esempio n. 6
0
from .custom_site import custom_site

router = DefaultRouter()
router.register(r'post', PostViewSet, base_name='api-post')
router.register(r'category', CategoryViewSet, base_name='api=category')

urlpatterns = [
    # path('', post_list, name='index'),
    # path('category/<category_id>', post_list, name='category-list'),
    # path('tag/<tag_id>', post_list, name='tag-list'),
    # path('post/<post_id>.html', post_detail, name='post-detail'),
    path('', IndexView.as_view(), name='index'),
    path('category/<category_id>',
         CategoryView.as_view(),
         name='category-list'),
    path('tag/<tag_id>', TagView.as_view(), name='tag-list'),
    path('post/<post_id>.html', PostDetailView.as_view(), name='post-detail'),
    path('search/', SearchView.as_view(), name='search'),
    path('author/<owner_id>', AuthorView.as_view(), name='author'),
    path('links/', LinkView.as_view(), name='links'),
    path('comment/', CommentView.as_view(), name='comment'),
    path('rss/', LatestPostFeed(), name='rss'),
    path('sitemap.xml', sitemap_views.sitemap,
         {'sitemaps': {
             'posts': PostSitemap
         }}),
    path('category-autocomplete/',
         CategoryAutocomplete.as_view(),
         name='category-autocomplete'),
    path('tag-autocomplete/',
         TagAutocomplete.as_view(),
Esempio n. 7
0
    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. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url, include
from django.views.static import serve
import xadmin

from blog.views import BlogView, CategoryView, ArchiveView, AboutView, ContentView, TagView
from wangcwblog.settings import MEDIA_ROOT

urlpatterns = [
    url(r'^$', BlogView.as_view(), name='home'),
    url(r'^xadmin/', xadmin.site.urls),
    url(r'^categories/$', CategoryView.as_view(), name='categories'),
    url(r'^category/(?P<category_id>[0-9]+)$',
        CategoryView.as_view(),
        name='category_id'),
    url(r'^archives/$', ArchiveView.as_view(), name='archives'),
    url(r'^tags/$', TagView.as_view(), name='tags'),
    url(r'^tag/(?P<tag_id>[0-9]+)$', TagView.as_view(), name='tag_id'),
    url(r'^about/$', AboutView.as_view(), name='about'),
    url(r'^content/(?P<article_id>[0-9]+)$',
        ContentView.as_view(),
        name='content'),
    url(r'^ueditor/', include('DjangoUeditor.urls')),
    url(r'media/(?P<path>.*)', serve, {'document_root': MEDIA_ROOT}),
]
Esempio n. 8
0
#!/usr/bin/python3
# encoding: utf-8
# @Time : 2019/3/3019:37
# @Author Superficial
# @File urls.py
# @Software PyCharm

from django.urls import path, re_path
from blog import views
from blog.views import IndexView, DetailView, CategoryView, TagView, ArchiveView

app_name = 'blog'

urlpatterns = [
    re_path('^$', IndexView.as_view(), name='index'),
    re_path(r'^category/(?P<nav_slug>.*?)/(?P<slug>.*?)$',
            CategoryView.as_view(),
            name='category'),
    re_path(r'tag/(?P<tag_name>.*?)/$', TagView.as_view(), name='tag'),
    path(r'article/<int:year>/<int:month>/<int:day>/<int:article_id>.html',
         DetailView.as_view(),
         name='detail'),
    re_path(r'archive/$', ArchiveView.as_view(), name='archive'),  # 归档页面
    # 全文搜索
    # re_path(r'^search/$', MySearchView.as_view(), name='search'),
    re_path(r'^search/$', views.search, name='search'),
    re_path(r'^about/$', views.about, name='about'),
]
Esempio n. 9
0
routers = DefaultRouter()
routers.register('post', PostViewSet, basename='api-post')
routers.register('category', CategoryViewSet, basename='api-category')
routers.register('tag', TagViewSet, basename='api-tag')

urlpatterns = [
    path('', IndexView.as_view(), name="index"),
    path('myposts/', MyPostsView.as_view(), name="my_posts"),
    path('post/<int:post_id>.html',
         PostDetailView.as_view(),
         name="post_detail"),
    path('category/<int:category_id>',
         CategoryView.as_view(),
         name="category_list"),
    path('tag/<int:tag_id>', TagView.as_view(), name="tag_list"),
    path('links/', LinkListView.as_view(), name="links"),
    path('search/<int:type_id>', SearchView.as_view(), name='search'),
    path('author/<int:author_id>', AuthorView.as_view(), name='author'),
    path('comment/', CommentView.as_view(), name='comment'),
    path('ckeditor/', include('ckeditor_uploader.urls')),
    path('rss/', LatestPostFeed(), name='rss'),
    path('sitemap.xml/',
         sitemap_views.sitemap, {'sitemaps': {
             'posts': PostSitemap
         }},
         name='sitemap'),
    path('super_admin/', admin.site.urls, name="super_admin"),
    path('admin/', custom_site.urls, name="admin"),
    path('api/', include((routers.urls, 'blog'), namespace='api')),
    path('api/docs/', include_docs_urls(title='API document')),
Esempio n. 10
0
from django.conf.urls import patterns, url
from blog.views import IndexView, TagView, PostView

urlpatterns = patterns(
    'blog.views',
    url(r'^$', IndexView.as_view(), {'page': 1}, name='index'),
    url(r'^feed/$', 'feed', name='feed'),
    url(r'^archive/$', 'archive', name='archive'),
    url(r'^post/(?P<slug>.*?)/$', PostView.as_view(), name='post'),
    url(r'^page/(?P<page>\d+)/$', IndexView.as_view(), name='index'),
    url(r'^tag/(?P<slug>.*?)/page/(?P<page>\d+)/$',
        TagView.as_view(),
        name='tag'),
    url(r'^tag/(?P<slug>.*?)/$', TagView.as_view(), name='tag'),
    url(r'^new/$', 'editor', name='new_post'),
    url(r'^edit/(?P<slug>.*?)/$', 'editor', name='edit_post'),
)
Esempio n. 11
0
urlpatterns = patterns(
    '',

    url(r'^admin/', include(admin.site.urls)),
    url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}),
    url(r'^logout/$', 'django.contrib.auth.views.logout', name='logout', kwargs={'next_page': '/'}),
    
    # Yandex access
    url(r'yandex_4176ffddb576e745.html$', 'webblog.views.yandex_access'),
    # robot.txt
    url(r'robots\.txt', 'webblog.views.robots'),


    url(r'^$', Home.as_view(), name='home'),
    url(r'^category/(?P<category>[_a-zA-Z0-9]+)/$', CategoryView.as_view(), name='category'),
    url(r'^tag/(?P<tag>[_a-zA-Z0-9]+)/$', TagView.as_view(), name='tag'),
    url(r'^post/(?P<post>[_a-zA-Z0-9/-]+)/$', PostView.as_view(), name='post'),
    # url(r'^webblog/', include('webblog.foo.urls')),

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


)

if settings.DEBUG:
    urlpatterns = patterns(
        '',
        url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
            {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
    ) + urlpatterns
Esempio n. 12
0
        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>.*)/$',
        PostCategoryView.as_view(),
        name='category'),
    url(r'^tag/(?P<id>\d+)/$', TagView.as_view(), name='tag'),
    url(r'^post/(?P<pk>[0-9]+)/tag/(?P<id>\d+)/$',
        TagView.as_view(),
        name='tag'),
    url(r'^categories/$', CategoryView.as_view(), name='category_list'),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Esempio n. 13
0
#coding=utf-8
from django.conf.urls import url
from blog.views import IndexView,ArticleView,UserView,AllView,CategoryView,TagView,SearchView
from django.views.generic import TemplateView,DetailView

urlpatterns = [
    url(r'^$',IndexView.as_view()),
    url(r'^article/(?P<pk>\d+).html$',ArticleView.as_view()),
    #url(r'^user/(?P<slug>\w+)$',UserView.as_view()),
    #url(r'^register/$',TemplateView.as_view(template_name="blog/register.html")),
    #url(r'^login/$',TemplateView.as_view(template_name="blog/login.html")),
    #url(r'^forgetpassword/$',TemplateView.as_view(template_name="blog/forgetpassword.html")),
    #url(r'^resetpassword/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)$',TemplateView.as_view(template_name="blog/resetpassword.html")),
    url(r'^all/$',AllView.as_view()),
    url(r'^category/(?P<id>\d+)/$',CategoryView.as_view()),
    url(r'^tag/(?P<id>\d+)/$',TagView.as_view()),
    url(r'^search/$',SearchView.as_view()),
]
Esempio n. 14
0
from typeidea.custom_site import custom_site
from .autocomplete import CategoryAutocomplete, TagsAutocomplete
# from blog.apis import post_list, PostList

router = DefaultRouter()
router.register(r'post', PostViewSet, basename='api-post')
router.register(r'category', CategoryViewSet, basename='api-category')
app_name = 'blog'

urlpatterns = [
    # path('', post_list, name='index'),
    path('', IndexView.as_view(), name='index'),
    path('category/<int:category_id>/',
         CategoryView.as_view(),
         name='category-list'),
    path('tag/<int:tag_id>/', TagView.as_view(), name='tag-list'),
    # path('post/<int:post_id>.html', post_detail, name='post-detail'),
    path('post/<int:post_id>.html',
         PostDetailView.as_view(),
         name='post-detail'),
    path('search/', SearchView.as_view(), name='search'),
    path('author/<int:owner_id>/', AuthorView.as_view(), name='author'),
    path('links/', LinkListView.as_view(), name='links'),
    path('comment/', CommentView.as_view(), name='comment'),
    path('super_admin/', admin.site.urls, name='super-admin'),
    path('admin/', custom_site.urls, name='admin'),
    path('xadmin/', xadmin.site.urls, name='admin'),
    path('ckeditor/', include('ckeditor_uploader.urls')),
    path('category-autocomplete/',
         CategoryAutocomplete.as_view(),
         name='category-autocomplete'),
Esempio n. 15
0
File: urls.py Progetto: jqlts1/blog
        url(r'^all/$', AllView.as_view(), name='all-view'),
        url(r'^search/$', SearchView.as_view()),
        url(r'^login/$',
            TemplateView.as_view(template_name="blog/login.html"),
            name='login-view'),
        url(r'^register/$',
            TemplateView.as_view(template_name="blog/register.html"),
            name='register-view'),
        url(r'^forgetpassword/$',
            TemplateView.as_view(template_name="blog/forgetpassword.html"),
            name='forgetpassword-view'),
        url(r'^resetpassword/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',
            TemplateView.as_view(template_name="blog/resetpassword.html"),
            name='resetpassword-view'),
        url(r'^column/(?P<column>\w+)/$',
            ColumnView.as_view(), name='column-detail-view'),
        url(r'^user/(?P<slug>\w+)$', UserView.as_view(), name='user-view'),
        url(r'^news/$', NewsView.as_view(), name='news-view'),
        url(r'^news/(?P<pk>\w+)$',
            DetailView.as_view(model=News), name='news-detail-view'),
        url(r'^tag/(?P<tag>\w+)/$', TagView.as_view(), name='tag-detail-view'),
        url(r'^(?P<category>\w+)/$',
            CategoryView.as_view(), name='category-detail-view'),
]


if settings.DEBUG:
    from django.conf.urls.static import static
    urlpatterns += static(
        settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Esempio n. 16
0
from django.conf.urls import url
from blog.views import IndexView, ArticleView, AboutView, AllView, DownView, SearchView, ColumnView, UserView, TagView, CategoryView
from django.views.generic import TemplateView, DetailView

urlpatterns = [
    url(r'^$', IndexView.as_view()),
    url(r'^article/(?P<slug>\w+).html$', ArticleView.as_view()),
    url(r'^all/$', AllView.as_view()),
    url(r'^search/$', SearchView.as_view()),
    url(r'^login/$', TemplateView.as_view(template_name="blog/login.html")),
    url(r'^register/$',
        TemplateView.as_view(template_name="blog/register.html")),
    url(r'^forgetpassword/$',
        TemplateView.as_view(template_name="blog/forgetpassword.html")),
    url(r'^resetpassword/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',
        TemplateView.as_view(template_name="blog/resetpassword.html")),
    url(r'^column/(?P<column>\w+)$', ColumnView.as_view()),
    url(r'^user/(?P<slug>\w+)$', UserView.as_view()),
    url(r'^tag/(?P<tag>\w+)/$', TagView.as_view()),
    url(r'^category/(?P<category>\w+)/$', CategoryView.as_view()),
    url(r'^about/$', AboutView.as_view()),
    url(r'^down/$', DownView.as_view()),
]
Esempio n. 17
0
from django.conf.urls import patterns, url,include
from blog.views import IndexView, TagView, PostView
from django.contrib import admin

urlpatterns = patterns(
    'blog.views',
    url(r'^$', IndexView.as_view(), {'page': 1}, name='index'),

    url(r'^archive/$', 'archive', name='archive'),
    url(r'^posts/(?P<slug>.*?)/$', PostView.as_view(), name='post'),
    url(r'^page/(?P<page>\d+)/$', IndexView.as_view(), name='index'),
    url(
        r'^tag/(?P<slug>.*?)/page/(?P<page>\d+)/$',
        TagView.as_view(),
        name='tag'
    ),
    url(r'^tag/(?P<slug>.*?)/$', TagView.as_view(), name='tag'),
    url(r'^admin/', include(admin.site.urls)),
    #url(r'^new/$', 'editor', name='new_post'),
    #url(r'^edit/(?P<slug>.*?)/$', 'editor', name='edit_post'),
    #url(r'^feed/$', 'feed', name='feed'),

)
Esempio n. 18
0

def statuc(prefix, **kwargs):
    return [
        url(r'^%s(?P<path>.*)$' % re.escape(prefix.lstrip('/')),
            serve,
            kwargs=kwargs)
    ]


urlpatterns = [
    url(r'^$', IndexView.as_view(), name="index"),
    url(r'^category/(?P<category_id>\d+)/',
        cache_page(60 * 10)(CategoryView.as_view()),
        name="category"),
    url(r'^tag/(?P<tag_id>\d+)/$', TagView.as_view(), name="tag"),
    url(r'^post/(?P<pk>\d+)/$', PostView.as_view(), name="detail"),
    url(r'^author/(?P<author_id>\d+)/$', AuthorView.as_view(), name="author"),
    url(r'^links/$', LinkView.as_view(), name="links"),
    url(r'^comment/$', CommentView.as_view(), name="comment"),
    url(r'^admin/', xadmin.site.urls),
    url(r'^category-autocomplete/$',
        CategoryAutocomplete.as_view(),
        name="category-autocomplete"),
    url(r'tag-autocomplete/$',
        TagAutocomplete.as_view(),
        name="tag-autocomplete"),
    url(r'ckeditor/', include('ckeditor_uploader.urls')),
    url(r'^api/docs/', include_docs_urls(title='blogproject apis')),
    url(r'^api/', include(router.urls)),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Esempio n. 19
0
__author__ = 'liuhui'

from django.conf.urls import url, include
from blog.views import IndexView, ArticleDetailView, CategoryView, TagView, ArticleEdit, IndexViewMine, ArticleUpdate, ArticleDelete

urlpatterns = [
    url(r'^$', IndexView.as_view(), name="index-view"),
    url(r'^article/(?P<article_id>\d+)/$',
        ArticleDetailView.as_view(),
        name='article-view'),
    url(r'^category/(?P<category_id>\d+)/$',
        CategoryView.as_view(),
        name='category-view'),
    url(r'^tag/(?P<tag>\d+)/$', TagView.as_view(), name='tag-view'),
    url(r'article_edit/$', ArticleEdit, name='article-edit'),
    url(r'^article_update/(?P<article_id>\d+)/$',
        ArticleUpdate,
        name='article-update'),
    url(r'^article_delete/(?P<article_id>\d+)/$',
        ArticleDelete,
        name='article-delete'),
    url(r'^article_mine/(?P<author_id>\d+)/$',
        IndexViewMine.as_view(),
        name='article-mine'),
]
Esempio n. 20
0
"""myblog URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.0/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'))
"""
from django.contrib import admin
from django.urls import path
from blog.views import IndexView, TagView,CategoryView,TagDetailView,CategoryDetailView,BlogDetailView
from comment.views import AddCommet
urlpatterns = [
    path('admin/', admin.site.urls),
    path('', IndexView.as_view(), name='index'),
    path('tags/', TagView.as_view(), name='tags'),
    path('category/', CategoryView.as_view(), name='category'),
    path('tags/<tagDetail>', TagDetailView.as_view(), name='tagDetail'),
    path('category/<categoryDetail>', CategoryDetailView.as_view(), name='categoryDetail'),
    path('blog/<blogDetail>', BlogDetailView.as_view(), name='blogDetail'),
    path('add_comment/<add_comment>', AddCommet.as_view(), name='add_comment'),
]
Esempio n. 21
0
from typeidea.autocomplete import CategoryAutocomplete, TagAutocomplete
# from blog.apis import post_list, PostList
from blog.apis import PostViewSet, CategoryViewSet, TagViewSet

router = DefaultRouter()
# 这里的basename就类似于名称空间,即url reverse的前缀。
router.register(r'post', PostViewSet, basename="api-post")
router.register(r'category', CategoryViewSet, basename="api-category")
router.register(r'tag', TagViewSet, basename="api-tag")

urlpatterns = [
    url(r'^$', IndexView.as_view(), name="post_list"),
    url(r'^category/(?P<category_id>\d+)/$',
        CategoryView.as_view(),
        name="post_list_by_category"),
    url(r'^tag/(?P<tag_id>\d+)/$', TagView.as_view(), name="post_list_by_tag"),
    url(r'^author/(?P<author_id>\d+)/$',
        AuthorView.as_view(),
        name="post_list_by_author"),
    url(r'^post/(?P<post_id>\d+).html/$',
        PostDetailView.as_view(),
        name="post_detail"),
    url(r'^keyword/$', SearchView.as_view(), name="search"),
    url(r'^links/$', LinkView.as_view(), name="links"),
    url(r'^comment/$', CommentView.as_view(), name="comment"),
    url(r'^category_autocomplete/$',
        CategoryAutocomplete.as_view(),
        name="category_autocomplete"),
    url(r'^tag_autocomplete/$',
        TagAutocomplete.as_view(),
        name="tag_autocomplete"),
Esempio n. 22
0
from django.urls import path, re_path

from blog.views import (
    ArticlesView,
    DashboardView,
    AddarticleView,
    ArticleView,
    UpdateView,
    DeleteView,
    CommentView,
    TagView,
)

app_name = 'blog'
urlpatterns = [
    re_path(r'^$', ArticlesView.as_view(), name='articles'),
    re_path(r'^(?P<id>\d+)/$', TagView.as_view(), name='tag'),
    re_path(r'^dashboard/$', DashboardView.as_view(), name='dashboard'),
    re_path(r'^addarticle/$', AddarticleView.as_view(), name='addarticle'),
    re_path(r'^article/(?P<id>\d+)/$', ArticleView.as_view(), name='article'),
    re_path(r'^update/(?P<id>\d+)/$', UpdateView.as_view(), name='update'),
    re_path(r'^delete/(?P<id>\d+)/$', DeleteView.as_view(), name='delete'),
    re_path(r'^comment/(?P<id>\d+)/$', CommentView.as_view(), name='comment'),
]
Esempio n. 23
0
    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'))
"""

from django.urls import path, re_path
from blog.views import IndexView, PostView, TagView, ArchiveView, CategoryView, SearchView

app_name = "blog"

urlpatterns = [
    re_path('^$', IndexView.as_view(), name='index'),
    re_path('post/(?P<pk>[0-9]+)/', PostView.as_view(), name='detail'),

    #文章归档目录页
    re_path('tag/(?P<pk>[0-9]+)/', TagView.as_view(), name='tag'),

    #导航分类页
    re_path('category/(?P<pk>[0-9]+)/',
            CategoryView.as_view(),
            name='category'),

    #文章归档目录页
    re_path('archive/(?P<year>[0-9]{4})/(?P<month>[0-9]{1,2})/',
            ArchiveView.as_view(),
            name='archive'),

    #搜索页
    re_path('search/', SearchView.as_view(), name='search'),
]
Esempio n. 24
0
    https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    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. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url, include
# from django.contrib import admin
import xadmin
import settings
from blog.views import IndexView, DetailView, TagView, SearchView
from django.conf.urls.static import static

urlpatterns = [
    url(r'^xadmin/', xadmin.site.urls, name="xadmin"),
    url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}, name="media"),
    url(r'^$', IndexView.as_view(), name="index"),
    url(r'^(?P<id>\d+)/$', DetailView.as_view(), name='detail'),
    url(r'^tag/(?P<tagId>.*)/$', TagView.as_view(), name='tag'),
    url(r'^search/$', SearchView.as_view(), name='search'),
    url(r'^ueditor/', include('DjangoUeditor.urls')),
]

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Esempio n. 25
0
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'))
"""
from django.contrib import admin
from django.urls import path, re_path

from blog.views import (IndexView, CategoryView, TagView, PostDetailView,
                        SearchView, AuthorView)
from comment.views import CommentView
from config.views import links, LinkListView
from typeidea.custom_site import custom_site

urlpatterns = [
    path('', IndexView.as_view(), name='index'),
    path('detail/', PostDetailView.as_view(), name='post-detail'),
    re_path('post/(?P<post_id>\d+).html',
            PostDetailView.as_view(),
            name='post-detail'),
    re_path('tag/(?P<tag_id>\d+)', TagView.as_view(), name='tag-list'),
    re_path('category/(?P<category_id>\d+)',
            CategoryView.as_view(),
            name='category-list'),
    path('links/', LinkListView.as_view(), name='links'),
    path('search/', SearchView.as_view(), name='search'),
    path('comment/', CommentView.as_view(), name='comment'),
    re_path('author/(?P<owner_id>\d+)/', AuthorView.as_view(), name='author'),
    path('super_admin/', admin.site.urls, name='super-admin'),
    path('admin/', custom_site.urls, name='admin'),
]
Esempio n. 26
0
"""
## funciotnView 的写法
urlpatterns = [
    url(r'^$', post_list, name='index'),
    url(r'^category/(?P<category_id>\d+)$', post_list, name="category-list"),
    url(r'^tag/(?P<tag_id>\d+)$', post_list, name="tag-list"),
    url(r'^post/(?P<post_id>\d+).html$', post_detail, name="post-detail"),
    url(r'^links$', links, name="links"),

    path('admin/', admin.site.urls),
    path('super_admin/', custom_site.urls),
]
"""
# class base view 写法
urlpatterns = [
    url(r'^$', IndexView.as_view(), name='index'),
    url(r'^category/(?P<category_id>\d+)$',
        CategoryView.as_view(),
        name="category-list"),
    url(r'^tag/(?P<tag_id>\d+)$', TagView.as_view(), name="tag-list"),
    url(r'^post/(?P<post_id>\d+).html$',
        PostDetailView.as_view(),
        name="post-detail"),
    url(r'^search/$', SearchView.as_view(), name="search"),
    url(r'^author/(?P<owner_id>\d+)$', AuthorView.as_view(), name="author"),
    url(r'^link/$', LinkListView.as_view(), name="links"),
    url(r'^comment/$', CommentView.as_view(), name="comment"),
    url(r'^super_admin/', admin.site.urls, name="super-admin"),
    url(r'^admin/', custom_site.urls, name="admin"),
]
Esempio n. 27
0
    url(r'^article/(?P<slug>[\s\S]*).html$',
        ArticleView.as_view(),
        name='article-detail-view'),
    url(r'^all/$', AllView.as_view(), name='all-view'),
    url(r'^search/$', SearchView.as_view()),
    url(r'^login/$',
        TemplateView.as_view(template_name="blog/login.html"),
        name='login-view'),
    url(r'^register/$',
        TemplateView.as_view(template_name="blog/register.html"),
        name='register-view'),
    url(r'^forgetpassword/$',
        TemplateView.as_view(template_name="blog/forgetpassword.html"),
        name='forgetpassword-view'),
    url(r'^resetpassword/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',
        TemplateView.as_view(template_name="blog/resetpassword.html"),
        name='resetpassword-view'),
    url(r'^column/(?P<column>[\s\S]*)/$',
        ColumnView.as_view(),
        name='column-detail-view'),
    url(r'^user/(?P<slug>[\s\S]*)$', UserView.as_view(), name='user-view'),
    url(r'^news/$', NewsView.as_view(), name='news-view'),
    url(r'^news/(?P<pk>[\s\S]*)$',
        DetailView.as_view(model=News),
        name='news-detail-view'),
    url(r'^tag/(?P<tag>[\s\S]*)/$', TagView.as_view(), name='tag-detail-view'),
    url(r'^category/(?P<category>[\s\S]*)/$',
        CategoryView.as_view(),
        name='category-detail-view'),
]
Esempio n. 28
0
from blog.views import (
    IndexView,
    ArticleView,
    AllView,
    SearchView,
    ColumnView,
    UserView,
    NewsView,
    TagView,
    CategoryView,
)
from django.views.generic import TemplateView, DetailView
from blog.models import News

urlpatterns = [
    url(r"^$", IndexView.as_view()),
    url(r"^article/(?P<slug>\w+).html$", ArticleView.as_view()),
    url(r"^all/$", AllView.as_view()),
    url(r"^search/$", SearchView.as_view()),
    #        url(r'^login/$',TemplateView.as_view(template_name="blog/login.html")),
    #        url(r'^register/$',TemplateView.as_view(template_name="blog/register.html")),
    #        url(r'^forgetpassword/$',TemplateView.as_view(template_name="blog/forgetpassword.html")),
    #        url(r'^resetpassword/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',TemplateView.as_view(template_name="blog/resetpassword.html")),
    url(r"^column/(?P<column>\w+)$", ColumnView.as_view()),
    url(r"^user/(?P<slug>\w+)$", UserView.as_view()),
    url(r"^about/$", NewsView.as_view()),
    url(r"^news/(?P<pk>\w+)$", DetailView.as_view(model=News)),
    url(r"^tag/(?P<tag>\w+)/$", TagView.as_view()),
    url(r"^category/(?P<category>\w+)/$", CategoryView.as_view()),
]
Esempio n. 29
0
from django.conf.urls import url
from blog.views import PostListView,PostCreateView,PostUpdateDeleteView, \
                PostDetailView,CommentView,TagView

urlpatterns = [
    url(r'^view/?$', PostListView.as_view(), name='view-all'),  #GET
    url(r'^create/?$', PostCreateView.as_view(), name='create-post'),  #POST
    url(r'^(?P<pk>\d+)$', PostDetailView.as_view(), name='view-one'),  #GET
    url(r'^(?P<pk>\d+)/update$',
        PostUpdateDeleteView.as_view(),
        name='update-post'),  #PUT
    url(r'^(?P<pk>\d+)/delete$',
        PostUpdateDeleteView.as_view(),
        name='delete-post'),  #DELETE
    url(r'^(?P<pk>\d+)/comment$',
        CommentView.as_view(),
        name='comment-on-post'),  #POST
    url(r'^(?P<pk>\d+)/vote', PostUpdateDeleteView.as_view(),
        name='vote-post'),  #PATCH
    url(r'^tag$', TagView.as_view(), name='list-tag'),  #GET
]
Esempio n. 30
0
__author__ = 'oldpan'
__date__ = '2017/8/11 9:37'

from django.conf.urls import url
from blog.views import BlogView, ArticleView, ArchivesView, CategoryView, TagView

app_name = 'blog'

urlpatterns = [
    url(r'^$', BlogView.as_view(), name='blog_page'),
    url(r'^post/(?P<pk>[0-9]+)/$', ArticleView.as_view(), name='article_page'),
    url(r'^archives/(?P<year>[0-9]{4})/(?P<month>[0-9]{1,2})/$',
        ArchivesView.as_view(),
        name='archives_page'),
    url(r'^category/(?P<pk>[0-9]+)/$',
        CategoryView.as_view(),
        name='category_page'),
    url(r'^tag/(?P<pk>[0-9]+)/$', TagView.as_view(), name='tag_page'),
]
Esempio n. 31
0
File: urls.py Progetto: notfier/blog
from django.conf.urls import patterns, url

from blog.views import PostsList, SinglePost, TagView, AllTagCloudView
from test_blog.settings import MEDIA_ROOT
# urls

urlpatterns = patterns(
    '',
    url(r'^tag/(?P<slug>\S+)/$', TagView.as_view(), name='tagger'),
    url(r'^post/add_comment/(?P<slug>\S+)/$',
        'blog.views.add_comment',
        name="commenter"),
    url(r'^$', PostsList.as_view(), name="all_posts"),
    url(r'^post/(?P<slug>\S+)/$', SinglePost.as_view(), name='single_post'),
)

urlpatterns += patterns(
    '',
    url(r'^media/pictures/(.+)/$', 'django.views.static.serve', {
        'document_root': MEDIA_ROOT,
    }),
)
Esempio n. 32
0
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
from django.contrib import admin
from .custom_site import custom_site
from blog.views import post_list, post_detail
from config.views import links
from blog.views import PostDetailView
from blog.views import (IndexView, CategoryView, TagView, PostDetailView)

urlpatterns = [

    # url(r"^$",post_list,name="tag_list"),
    url(r"^$", IndexView.as_view(), name="index"),
    # url(r"^category/(?P<category_id>\d+)/$",post_list,name="category_list"),
    url(r"^category/(?P<category_id>\d+)/$",
        CategoryView.as_view(),
        name="category_list"),
    # url(r"^tag/(?P<tag_id>\d+)/$",post_list,name="tag_list"),
    url(r"^tag/(?P<tag_id>\d+)/$", TagView.as_view(), name="tag_list"),
    # url(r"^post/(?P<post_id>\d+).html/$",post_detail,name="post_detail"),
    url(r"^post/(?P<pk>\d+).html/$",
        PostDetailView.as_view(),
        name="post_detail"),
    url(r"^links/$", links, name="links"),
    url(r'^admin/', admin.site.urls, name="admin"),
    url(r'^super_admin/', custom_site.urls, name="super_admin"),
]
Esempio n. 33
0
    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'))
"""
from django.contrib import admin
from django.urls import path
from blog.views import (IndexView, CategoryView, TagView, PostDetailView,
                        SearchView)

from config.views import links
from .custom_site import custom_site

urlpatterns = [
    path('super_admin/', admin.site.urls, name="super-admin"),
    path('admin/', custom_site.urls, name="admin"),
    path("", IndexView.as_view(), name="index"),
    path("category/<int:category_id>",
         CategoryView.as_view(),
         name="category-list"),
    path("tag/<int:tag_id>", TagView.as_view(), name="tag-list"),
    path("post/<int:post_id>.html",
         PostDetailView.as_view(),
         name="post-detail"),
    path("links", links, name="links"),
    path("search/", SearchView.as_view(), name='search')
]
Esempio n. 34
0
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
import xadmin
from django.contrib import admin
from django.urls import path
from django.conf.urls import url, include
from django.conf import settings
from django.conf.urls.static import static
from blog.views import IndexView, CategoryView, TagView, PostDetailView, SearchView, AuthorView
from config.views import LinkListView
from comment.views import CommentView
from .custom_site import custom_site
from .autocomplete import CategoryAutoComplete, TagAutoComplete
urlpatterns = [
    url(r'^$', IndexView.as_view(), name='index'),
    url(r'^search/$', SearchView.as_view(), name='search'),
    url(r'^category/(?P<category_id>\d+)/$', CategoryView.as_view(), name='category-list'),
    url(r'^tag/(?P<tag_id>\d+)/$', TagView.as_view(), name='tag-list'),
    url(r'^post/(?P<post_id>\d+).html$', PostDetailView.as_view(), name='post-detail'),
    url(r'^author/(?P<owner_id>\d+).html$', AuthorView.as_view(), name='author'),
    url(r'^links/$', LinkListView.as_view(), name='links'),
    url(r'^comment/$', CommentView.as_view(), name='comment'),
    url(r'^super_admin/', admin.site.urls, name='super-admin'),
    # url(r'^admin/', custom_site.urls, name='admin'),
    url(r'^admin/', xadmin.site.urls, name='xadmin'),
    url(r'^category-autocomplete/$', CategoryAutoComplete.as_view(), name='category-autocomplete'),
    url(r'^tag-autocomplete/$', TagAutoComplete.as_view(), name='tag-autocomplete'),
    url(r'^ckeditor/', include('ckeditor_uploader.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Esempio n. 35
0
from django.conf.urls import patterns, url
from blog.views import IndexView, TagView, PostView

urlpatterns = patterns(
    "blog.views",
    url(r"^$", IndexView.as_view(), {"page": 1}, name="index_1"),
    url(r"^feed/$", "feed", name="feed"),
    url(r"^archive/$", "archive", name="archive"),
    url(r"^post/(?P<slug>.*?)/$", PostView.as_view(), name="post"),
    url(r"^page/(?P<page>\d+)/$", IndexView.as_view(), name="index"),
    url(r"^tag/(?P<slug>.*?)/page/(?P<page>\d+)/$", TagView.as_view(), name="tag"),
    url(r"^tag/(?P<slug>.*?)/$", TagView.as_view(), name="tag_1"),
    url(r"^new/$", "editor", name="new_post"),
    url(r"^edit/(?P<slug>.*?)/$", "editor", name="edit_post"),
)