Пример #1
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
]
Пример #2
0
from django.urls import path
from blog.views import BlogPostView, LikeView, CommentView, ListBlogView

urlpatterns = [
    path("post/list/", ListBlogView.as_view()),
    path("post/", BlogPostView.as_view()),
    path("like/<int:id>/", LikeView.as_view()),
    path("comment/", CommentView.as_view()),
]
Пример #3
0
    # https://127.0.0.1:8000/tag/1/
    # 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'),

    # https://127.0.0.1:8000/post/2.html
    # url(r'^post/(?P<post_id>\d+).html$', post_detail, name='post-detail'),
    url(r'^post/(?P<post_id>\d+).html$',
        PostDetailView.as_view(),
        name='post-detail'),

    # https://127.0.0.1:8000/links/
    url(r'^links/$', LinkListView.as_view(), name='links'),
    url(r'^search/$', SearchView.as_view(), name='search'),
    url(r'^author/(?P<owner_id>\d+)/$', AuthorView.as_view(), name='author'),
    url(r'^comment/$', CommentView.as_view(), name='comment'),
    url(r'^rss|feed/', LatestPostFeed(), name='rss'),
    # url(r'^sitemap\.xml$', sitemap_views.sitemap, {'sitemaps': {'posts': PostSitemap}}),
    # 缓存sitemap接口
    url(
        r'sitemap\.xml$',
        cache_page(60 * 20, key_prefix='sitemap_cache_')(
            sitemap_views.sitemap), {'sitemaps': {
                'posts': PostSitemap
            }}),
    url(r'^category-autocomplete/$',
        CategoryAutocomplete.as_view(),
        name='category-autocomplete'),
    url(r'^tag-autocomplete/$',
        TagAutocomplete.as_view(),
        name='tag-autocomplete'),
Пример #4
0
The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.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 blog import views
from django.contrib import admin
from blog.views import CommentView
from django.urls import path, include
from django.conf.urls import url

urlpatterns = [
    path('admin/', admin.site.urls),
    path('post/post_list', views.post_list, name='post'),
    # path('', views.post_list, name='post_list'),
    path('post/<int:pk>/', views.post_detail, name='post_detail'),
    path('post/new/', views.post_new, name='post_new'),
    url(r'^watson/', CommentView.as_view(), name='comment'),
    #url(r'^posts/', BlogPosts.as_view(), name='comment'),
]
Пример #5
0
import blog
from blog.views import GrantBlogView, CompileBlogEntry, TestView, IndexView, CommentView, ReplyView
from userinfo.views import RegisterView, LoginView, IsVailTokenView, UserInfoView

urlpatterns = [
    path('admin/', admin.site.urls),
]

urlpatterns += [
    path("", RedirectView.as_view(url="/blog/jz_zhou/list")),
    re_path(r"blog/(?P<username>\w+(-*)\w+)/(?P<data>\w+)/$",
            IndexView.as_view()),
    # path("index/<int:page>/", index),
    path("login/", LoginView.as_view()),
    path("is_login/", IsVailTokenView.as_view()),
    path("register/", RegisterView.as_view()),
    path("grant_blog/", GrantBlogView.as_view()),
    re_path("compile_blog/(?P<username>\w+(-*)\w+)/",
            CompileBlogEntry.as_view()),
    re_path("userinfo/(?P<username>\w+(-*)\w+)/$", UserInfoView.as_view()),
    re_path(r'^test/(?P<username>\w+)/$', TestView.as_view()),
    re_path(r"(?P<username>\w+(-*)\w+)/", include("blog.urls")),
    re_path(r"(?P<username>\w+(-*)\w+)/comment/(?P<article_id>\w+)/$",
            CommentView.as_view()),
    re_path(r"comment/list/(?P<article_id>\w+)/(?P<page>\w+)/$",
            CommentView.as_view()),
    re_path(r"reply_list/(?P<comment_id>\w+)/(?P<page>\w+)/$",
            ReplyView.as_view()),
    re_path(r"reply/(?P<username>\w+(-*)\w+)/reply/(?P<comment_id>\w+)/$",
            ReplyView.as_view()),
]
Пример #6
0
from django.urls import path

from blog.views import PostListView, PostDetailView, GetPostLike, SearchView, CommentView, PostByCategory

urlpatterns = [
    path('', PostListView.as_view(), name='posts'),
    path('post/<slug:slug>', PostDetailView.as_view(), name='post'),
    path('like/<slug:slug>', GetPostLike.as_view(), name='like'),
    path('search/', SearchView.as_view(), name='search'),
    path('comment/<slug:slug>', CommentView.as_view(), name='comment'),
    path('category/<slug:slug>', PostByCategory.as_view(), name='post_category'),
]
Пример #7
0
from django.urls import path

from blog.views import get_profile, get_my_age, PostView, CommentView

urlpatterns = [
    path('hello/', get_profile),
    path('my-age/', get_my_age),
    path('posts/', PostView.as_view()),
    path('comments/', CommentView.as_view())
]


Пример #8
0
from django.conf.urls import url
from blog.views import IndexView,ArticleView,CommentView,ZanView,google_yanzheng
from django.views.generic import TemplateView

urlpatterns = [
		url(r'^$',IndexView.as_view(),name='index-view'),
        url(r'^blog/(?P<pk>\d+).html$',ArticleView.as_view(),name='article-detail-view'),
        url(r'^comment/(?P<pk>\d+)',CommentView.as_view()),
        url(r'^zan',ZanView.as_view()),
        url(r'^change-password$',TemplateView.as_view(template_name="blog/change_passwd.html"),name="change-posswd-view"),
        url(r'^googlef5c50adcb3c8f8e0.html$',google_yanzheng),
]
Пример #9
0
from django.urls import path
from blog.views import (PostListView, PostCreateView, PostDetailView,
                        PostUpdateView, PostDeleteView, CommentView,
                        CommentDeleteView)

app_name = "blog"

urlpatterns = [
    # User posts
    path('user/<str:username>/', PostListView.as_view(), name='user-posts'),
    # Posts by date
    path('date/<str:date>/', PostListView.as_view(), name='date-posts'),
    # New post
    path('new/', PostCreateView.as_view(), name='new-post'),
    # All post
    path('<slug>/', PostDetailView.as_view(), name='post-detail'),
    # Update post
    path('<slug>/update/', PostUpdateView.as_view(), name='post-update'),
    # Delete post
    path('<slug>/delete/', PostDeleteView.as_view(), name='post-delete'),
    # New comment
    path('comment/<slug>/new/', CommentView.as_view(), name='new-comment'),
    # Delete comment
    path('comment/delete/<int:pk>/',
         CommentDeleteView.as_view(),
         name='comment-delete'),
]
Пример #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())
]
Пример #11
0
from django.conf.urls import url
from blog.views import PostListView, PostView, CommentListView, CommentView

urlpatterns = [
    url('posts', PostListView.as_view()),
    url('post/(?P<id>[0-9]+)', PostView.as_view()),
    url('post', PostView.as_view()),
    url('comments', CommentListView.as_view()),
    url('comment/(?P<id>[0-9]+)', CommentView.as_view()),
    url('comment', CommentView.as_view()),
]
Пример #12
0
from django.urls import path
from blog.views import PostView, PostDetail, PostCreate, PostUpdate, PostDelete, likeView, CommentView, add_comment_to_post
app_name = 'blog'
urlpatterns = [
    path('', PostView.as_view(), name='post-list'),
    path('detail/<int:pk>/', PostDetail.as_view(), name='post-detail'),
    path('create/', PostCreate.as_view(), name='post-create'),
    path('update/<int:pk>/', PostUpdate.as_view(), name='post-update'),
    path('delete/<int:pk>/', PostDelete.as_view(), name='post-delete'),
    path('ajax/likes/', likeView, name='like'),
    path('comment/', CommentView.as_view(), name='comment'),
    path('detail/<int:pk>/comment/', add_comment_to_post, name='post-comment'),
]
Пример #13
0
from django.urls import re_path

from blog.views import DetailView, CommentView, UpOrDownView, AddArticleView

app_name = "[blog.urls,]"

urlpatterns = [
    re_path(r"^detail/(?P<article_id>\d+)/$",
            DetailView.as_view(),
            name="detail"),
    re_path(r"^upordown/$", UpOrDownView.as_view(), name="upordown"),
    re_path(r"^comment/$", CommentView.as_view(), name="comment"),
    re_path(r"^add_article/$", AddArticleView.as_view(), name="add_article"),
]
Пример #14
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'),
]
Пример #15
0
from django.conf.urls import url
from blog.views import ArticleView,CategoryView,UserView,IndexView,CommentView,SearchView,AboutView,TagView,ArchiveView
from django.views.generic import TemplateView

urlpatterns=[
    url(r'^$',IndexView.as_view()),
    url(r'^article/(?P<slug>\w+).html',ArticleView.as_view()),
    url(r'^category/(?P<category>\w+)/$',CategoryView.as_view()),
    url(r'^user/(?P<slug>\w+)/$',UserView.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'^comment/(?P<slug>\w+)$',CommentView.as_view()),
    url(r'^search/$',SearchView.as_view()),
    # url(r'^about/$',TemplateView.as_view(template_name="blog/about.html")),
    url(r'^about/$',AboutView.as_view()),
    url(r'^tag/(?P<tag>\w+)/$',TagView.as_view()),
    url(r'^archives/$',ArchiveView.as_view()),
]
Пример #16
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())
]
Пример #17
0
    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.conf.urls import url
from django.contrib import admin
from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns
from blog import views
from rest_framework.authtoken import views as restView

from blog.views import PostView, CommentView

# test()

urlpatterns = [
    path('admin/', admin.site.urls),
    path('users/', views.UserList.as_view()),
    path('login/', views.login_user),
    path('signup/', views.signup),
    path('delete/<str:username>/', views.user_detail),
    path('token/', views.token),
    path('gettoken/', restView.obtain_auth_token),
    url(r'^post/', PostView.as_view()),
    url(r'^comment/', CommentView.as_view()),
]

urlpatterns = format_suffix_patterns(urlpatterns)