Didnt return an Httpresponse object.it returned none instead

Didnt return an Httpresponse object.it returned none instead
0

#1
    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', {})

#2

The solution is pretty straight forward.

First it checks to see if the request being received is a “POST” request, if it isn’t then it returns None (You probably want to return a 401).

If the request IS A POST REQUEST, it then checks to see if “addtask” is in request.POST, if it doesn’t exist then it returns None.

None is being returned because one of your if statements is failing and there’s no else statement to return something else.