Beispiel #1
0
def edit_comment(request, comment_id):
    comment = logic.get_comment(comment_id)
    if request.method == 'POST':
        print "going to edit comment by: ", comment.user.nickname
        logic.edit_comment(request, comment)
        return HttpResponseRedirect('/comments/show_comment/' + str(comment.id))
    elif request.method == 'GET':
        comment_form = CommentForm(instance=comment)
        return render(request, 'comments/edit_comment.html',
                      {'form': comment_form, 'comment': comment})
Beispiel #2
0
def delete_comment(request, comment_id):
    comment = logic.get_comment(comment_id)
    if not logic.delete_comment(request, comment):
        return HttpResponseRedirect('/comments/show_comment/'+str(comment_id))
    return HttpResponseRedirect('/comments/show_comment/'+str(comment_id))
Beispiel #3
0
def show_comment(request, comment_id):
    comment = logic.get_comment(comment_id)
    return render(request, 'comments/show_comment.html', {'comment':comment})