Example #1
0
def list_comments(request, storyID):
    story = mdl_story.get_story(storyID)
    comments = mdl_comment.get_comments_for_story(story)
    form = CommentForm()
    context = {
        'story': story,
        'comments': comments,
        'newform': form
    }
    return render(request, 'CommentList.html', context)
def list_comments(request, storyID):
    story = mdl_story.get_story(storyID)
    comments = mdl_comment.get_comments_for_story(story)
    form = CommentForm()
    context = {
        'story': story,
        'comments': comments,
        'newform': form
    }
    return render(request, 'CommentList.html', context)
Example #3
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)
Example #4
0
def add_comment_into_list(request, storyID):
    story = mdl_story.get_story(storyID)
    if request.method == 'POST':
        form = CommentForm(request.POST)
        if form.is_valid():
            mdl_comment.create_comment(story, request.POST)
    else:
        form = CommentForm()
    comments = mdl_comment.get_comments_for_story(story)
    context = {'story': story, 'comments': comments, 'newform': form}
    return render(request, 'CommentList.html', context)
Example #5
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)
Example #6
0
def add_comment_into_list(request, storyID):
    story = mdl_story.get_story(storyID)
    if request.method == 'POST':
        form = CommentForm(request.POST)
        if form.is_valid():
            mdl_comment.create_comment(story,request.POST)
    else:
        form = CommentForm()
    comments = mdl_comment.get_comments_for_story(story)
    context = {
        'story': story,
        'comments': comments,
        'newform': form
    }
    return render(request, 'CommentList.html', context)
Example #7
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)
Example #8
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)