示例#1
0
def home(request, pk):
    if request.method == 'POST':
        post = get_object_or_404(Post, id=pk)
        form = CommentCreateView(request.POST)
        if form.form_valid(post):
            form.save()
            messages.success(request, f'Your comment is posted!')
            return redirect('post-comments', pk)
    else:
        context = {
            'post': get_object_or_404(Post, id=pk),
            'form': CommentCreateView()
        }
    return render(request, 'blog/post_detail.comments.html', context)
示例#2
0
文件: urls.py 项目: jorvalu/omaiga
         ProfileSentView.as_view(),
         name='profile_sent'),
    path('accounts/profile/<username>/voted',
         ProfileVotedView.as_view(),
         name='profile_voted'),
    path('accounts/profile/<username>/comments',
         ProfileCommentsView.as_view(),
         name='profile_comments'),

    # links app
    path('', LinkListView.as_view(), name='link_list'),
    path('latest/', LinkLatestView.as_view(), name='link_latest'),
    path('top/', LinkTopView.as_view(), name='link_top'),
    path('create/', LinkCreateView.as_view(), name='link_create'),
    path('detail/<pk>', LinkDetailView.as_view(), name='link_detail'),
    path('update/<pk>', LinkUpdateView.as_view(), name='link_update'),
    path('delete/<pk>', LinkDeleteView.as_view(), name='link_delete'),

    # voting app
    path('vote/<pk>', VoteView.as_view(), name='vote'),

    # comments app
    path('detail/<pk>/comment',
         CommentCreateView.as_view(),
         name='comment_create'),
    path('detail/<id>/comment/delete/<pk>',
         CommentDeleteView.as_view(),
         name='comment_delete'),
    path('detail/comment/point/<pk>/', PointView.as_view(), name='point'),
]
示例#3
0
from comments.views import CommentCreateView
from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView
from django.contrib import admin

__author__ = 'pahaz'

urlpatterns = patterns('',
   url(r'^add$', CommentCreateView.as_view(), name="comments_add"),
)
示例#4
0
文件: urls.py 项目: danho-vak/YTBL_v2
from django.urls import path

from comments.views import CommentCreateView, CommentDeleteView, GetLastCommentView, CommentChildCreateView

app_name = 'comments'

urlpatterns = [
    path('create/<int:post_id>', CommentCreateView.as_view(), name='create'),
    path('<int:post_id>/<int:comment_id>/child/create',
         CommentChildCreateView.as_view(),
         name='child_create'),
    path('delete/<int:comment_id>', CommentDeleteView.as_view(),
         name='delete'),
    path('last/<int:post_id>', GetLastCommentView.as_view(), name='last'),
]
示例#5
0
文件: urls.py 项目: Mrk2239/KProject
#!/usr/bin/env python
# encoding: utf-8
'''
@author: kdb

@file: urls.py
@time: 2018/7/7 0007 上午 11:51

'''


from django.conf.urls import url

from comments.views import post_comment,CommentCreateView

urlpatterns = [

    #url(r'^post_comment/(?P<pk>\d+)/$',post_comment,name='post_comment' ),
    url(r'^post_comment/(?P<pk>\d+)/$',CommentCreateView.as_view(),name='post_comment' ),
]
示例#6
0
from django.urls import path

from comments.views import CommentListView, CommentCreateView, CommentDeleteView

app_name = 'comments'

urlpatterns = [
    path('list/<slug:slug>/', CommentListView.as_view(), name='list'),
    path('delete/<int:pk>/', CommentDeleteView.as_view(), name='delete'),
    path('create/<int:pk>/', CommentCreateView.as_view(), name='create'),
]