Beispiel #1
0
def delete_comment_solution(request, solution, comment_id):
    comment = comments_logic.get_comment(comment_id)
    if comment:
        if comment in solution.comments.all():
            solution.comments.remove(comment)
        else:
            return False
        comments_logic.delete_comment(request, comment)
        return True
    else:
        print "something went wrong, couldn't find comment"
        return False
Beispiel #2
0
def delete_comment_problem(request, problem, comment_id):
    print "inside logic deletecommentproblem"
    comment = comments_logic.get_comment(comment_id)
    if comment:
        if comment in problem.comments.all():
            problem.comments.remove(comment)
        else:
            return False
        comments_logic.delete_comment(request, comment)
        return True
    else:
        print "something went wrong, couldn't find comment"
        return False
Beispiel #3
0
def delete_comment_problem(request, problem, comment_id):
    print "inside logic deletecommentproblem"
    comment = comments_logic.get_comment(comment_id)
    if comment and is_authorized(comment, request.session["email"]):
        if comment in problem.comments.all():
            problem.comments.remove(comment)
        else:
            return False
        problem.save()
        comments_logic.delete_comment(request, comment)
        return True
    else:
        print "something went wrong, couldn't find comment"
        return False
Beispiel #4
0
def delete_comment_solution(request, solution, comment_id):
    comment = comments_logic.get_comment(comment_id)
    if comment and is_authorized(comment, request.session["email"]):
        if comment in solution.comments.all():
            print "Removing solution's comment. ", comment.content
            solution.comments.remove(comment)

        else:
            return False
        solution.save()
        comments_logic.delete_comment(request, comment)
        return True
    else:
        print "something went wrong, couldn't find comment"
        return False