Didn't return an HttpResponse object. It returned None instead

Didn't return an HttpResponse object. It returned None instead
0

#1

hi, i need help on this

def taskmanager(request,):
    todo = Exercise.objects.all()
    practices = Practice.objects.all()
    if request.method == "POST":
        if "addtask" in request.POST:
            title = request.POST["description"]
            date = str(request.POST["date"])
            practice = request.POST["practice_select"]
            description = title + "--" + date + " " + practice
            todos = Exercise(title=title, description=description, due_date=date, practice=Practice.objects.get(name=practice))

            if todo. is_valid():
                todo.save()
                return render(request, 'appnow/taskmanager.html', {})
            else:
                return render(request, 'appnow/index.html', {})

BUT I KEPT GETTING DIDNT RETURN AN HTTPRESPONSE OBJECT. pls what is wrong


#2

I’ve edited your post for readability. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.