Exemple #1
0
def remove_comment_from_list(request, storyID, commentID):
    story = mdl_story.get_story(storyID)
    comment = mdl_comment.get_comment(commentID)
    if request.method == 'POST':
        comment.delete()
    comments = mdl_comment.get_comments_for_story(story)
    form = CommentForm()

    context = {'story': story, 'comments': comments, 'newform': form}

    return render(request, 'CommentList.html', context)
Exemple #2
0
def remove_comment_from_list(request, storyID, commentID):
    story = mdl_story.get_story(storyID)
    comment = mdl_comment.get_comment(commentID)
    if request.method == 'POST':
        comment.delete()
    comments = mdl_comment.get_comments_for_story(story)
    form = CommentForm()

    context = {
        'story': story,
        'comments': comments,
        'newform': form
    }

    return render(request, 'CommentList.html', context)
Exemple #3
0
def edit_comment_in_list(request, storyID, commentID):
    story = mdl_story.get_story(storyID)
    comment = mdl_comment.get_comment(commentID)
    if request.method == 'POST':
        form = CommentForm(request.POST, instance=comment)
        if form.is_valid():
            comment = form.save(commit=True)
    else:
        form = CommentForm(instance=comment)
    comments = mdl_comment.get_comments_for_story(story)

    context = {
        'story': story,
        'comments': comments,
        'comment': comment,
        'editform': form,
    }

    return render(request, 'CommentList.html', context)
Exemple #4
0
def edit_comment_in_list(request, storyID, commentID):
    story = mdl_story.get_story(storyID)
    comment = mdl_comment.get_comment(commentID)
    if request.method == 'POST':
        form = CommentForm(request.POST, instance=comment)
        if form.is_valid():
            comment = form.save(commit=True)
    else:
        form = CommentForm(instance=comment)
    comments = mdl_comment.get_comments_for_story(story)

    context = {
        'story': story,
        'comments': comments,
        'comment': comment,
        'editform': form,
    }

    return render(request, 'CommentList.html', context)