示例#1
0
from django.urls import path ,re_path
from blog.views import index
from blog.views import post_details,contact_view,post_form_view,post_edit_form_view,PostListView,PostDetailView,PostFormView,ContactFormView,PostFormUpdateView


urlpatterns = [
    # path('',index),
    path('',PostListView.as_view()),
    # path("<int:id>",post_details),
    # path("<int:pk>",PostDetailView.as_view()),
    path("posts",PostFormView.as_view()),
    path("posts/<slug:slug>",PostFormUpdateView.as_view()),
    path("contact",ContactFormView.as_view()),
    path("<slug:slug>",PostDetailView.as_view(),name ="post-detail"),
    # path("contact",contact_view),
    
    # path("posts",post_form_view),


]

# "post-detail" => "<slug:slug>"

# url "post-detail" "abc" = "/abc" => valid url 
# a= 10 
# print(a)

# post-detail = "post/<slug:slug>""

# {% url 'url_name' args %}
示例#2
0
from django.contrib import admin
from django.urls import path, include
from blog.views import IndexView, CategoryIndexView, BlogDetailView, ContactFormView, PostModelFormView, PostFormUpdateView, PostDeleteView

urlpatterns = [
    path('', IndexView.as_view()),
    path('contactus', ContactFormView.as_view(), name='contact-us'),
    path('posts', PostModelFormView.as_view(), name='new-post'),
    path('posts/<slug:slug>', PostFormUpdateView.as_view(),
         name='update-post'),
    path('<slug:slug>', BlogDetailView.as_view(), name='post-detail'),
    path('delete/<slug:slug>', PostDeleteView.as_view(), name='delete-post'),
]
示例#3
0
from django.urls import path
from blog.views import (ArticleListView, 
                    ArticleDetailView, 
                    ArticleDeleteView, 
                    ArticleFormView, 
                    ContactFormView, 
                    CategoriesArticleListView, 
                    ArticleUptadeView, 
                    CommentDeleteView)
                    

urlpatterns = [
    
    path('', ArticleListView.as_view(), name="homepage"),
    path('article/<slug:slug>', ArticleDetailView.as_view(), name="article-detail"),
    path('article/delete/<slug:slug>', ArticleDeleteView.as_view(), name="article-delete"),
    path('article/create/', ArticleFormView.as_view(), name="article-create"),
    path('article/edit/<slug:slug>', ArticleUptadeView.as_view(), name="article-edit"),

    path('comment/delete/<int:id>', CommentDeleteView.as_view(), name="comment-delete"),


    path('contact/', ContactFormView.as_view(), name="contact"),
    path('category/<slug:slug>', CategoriesArticleListView.as_view(), name="category"),
]
示例#4
0
from django.urls import path, re_path
# from blog.views import index
from blog.views import indexPage, PostListView, PostFormView, search_code, view_by_cat_button, BtnBlogDetails, ContactFormView, post_edit_form_view, PostDetailsView, PostFormUpdateView, PostFormDeleteView

urlpatterns = [
    # path("index", indexPage),
    path("",
         PostListView.as_view(template_name="blog/index.html"),
         name="index"),
    # path("<int:id>", post_details),
    # path("<int:pk>", PostDetailsView.as_view()),
    path("posts",
         PostFormView.as_view(template_name="blog/post.html"),
         name="post"),
    # path("posts", post_form_view),
    path("search/", search_code, name="search"),
    path("contact",
         ContactFormView.as_view(template_name="blog/contact.html"),
         name="contact"),
    path("filter/<int:id>", view_by_cat_button),
    path("filter/<slug:slug>", BtnBlogDetails.as_view()),
    path("<slug:slug>", PostDetailsView.as_view(), name="post-detail"),
    path("posts/<slug:slug>", PostFormUpdateView.as_view(),
         name="update-blog"),
    path(
        "delete/<slug:slug>",
        PostFormDeleteView.as_view(),
        name="delete-blog",
    )
]
示例#5
0
from django.contrib import admin
from django.urls import path, include
from blog.views import IndexView, CategoryIndexView, BlogDetailView, ContactFormView, PostModelFormView, PostFormUpdateView

urlpatterns = [
    path('', IndexView.as_view()),
    path('contact', ContactFormView.as_view()),
    path('posts', PostModelFormView.as_view()),
    path('posts/<slug:slug>', PostFormUpdateView.as_view(),
         name='update-post'),
    path('<slug:slug>', BlogDetailView.as_view(), name='post-detail'),
]
示例#6
0
from django.urls import path
from blog.views import IndexView, AboutView, ContactFormView, ContactResultView, PostDetailView, TagListView, SearchPostView, TagPostView, CommentFormView, comment_approve, comment_remove, ReplyFormView, reply_approve, reply_remove
from django.conf import settings
from django.conf.urls.static import static

app_name = 'blog'
urlpatterns = [
    path("", IndexView.as_view(), name="index"),
    path("about/", AboutView.as_view(), name="about"),
    path("contact/", ContactFormView.as_view(), name="contact"),
    path("contact/contact_result/",
         ContactResultView.as_view(),
         name="contact_result"),
    path("post/<int:pk>/", PostDetailView.as_view(), name="post_detail"),
    path("tags/", TagListView.as_view(), name="tag_list"),
    path('tag/<str:tag_slug>/', TagPostView.as_view(), name='tag_post'),
    path('search/', SearchPostView.as_view(), name='search_post'),
    path('comment/<int:pk>/', CommentFormView.as_view(), name='comment_form'),
    path('comment/<int:pk>/approve/', comment_approve, name='comment_approve'),
    path('comment/<int:pk>/remove/', comment_remove, name='comment_remove'),
    path('reply/<int:pk>/', ReplyFormView.as_view(), name='reply_form'),
    path('reply/<int:pk>/approve/', reply_approve, name='reply_approve'),
    path('reply/<int:pk>/remove/', reply_remove, name='reply_remove'),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)