The view didn't return an HttpResponse object. It returned None instead
Because the view must return render
, not just call it. Change the last line to
return render(request, 'auth_lifecycle/user_profile.html',
context_instance=RequestContext(request))
if qs.count()==1:
print('cart id exists')
if ....
else:
return render(request,"carts/home.html",{})
Such type of code will also return you the same error this is because of the intents as the return statement should be for else not for if statement.
above code can be changed to
if qs.count()==1:
print('cart id exists')
if ....
else:
return render(request,"carts/home.html",{})
This may solve such issues
I had the same error using an UpdateView
I had this:
if form.is_valid() and form2.is_valid():
form.save()
form2.save()
return HttpResponseRedirect(self.get_success_url())
and I solved just doing:
if form.is_valid() and form2.is_valid():
form.save()
form2.save()
return HttpResponseRedirect(reverse_lazy('adopcion:solicitud_listar'))