def addProblem(request):
    form = ProblemForm(request.POST)
    if request.method == "POST":
        if form.is_valid():
            form.save()
            return HttpResponseRedirect("/problem_list")
        else:
            error_message = Constants.INCORRECT_INPUT
    return TemplateResponse(request, "problems/add_problem.html", locals())
def editProblem(request):
    problem = Problem.objects.get(id=request.GET["problem_id"])
    if request.method == "POST":
        form = ProblemForm(request.POST, instance=problem)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect("/problem_list")
        else:
            error_message = Constants.INCORRECT_INPUT
    else:
        form = ProblemForm(instance=problem)
        problem_id = request.GET["problem_id"]
    return TemplateResponse(request, "problems/edit_problem.html", locals())