Django “The view didn't return an HttpResponse object.”

前端 未结 3 1644
臣服心动
臣服心动 2020-12-15 08:15

I have a simple view in which I\'m saving a form. The code seems \'clean\', but I can\'t get rid of the error:

"The view didn\'t return an HttpRespo

3条回答
  •  被撕碎了的回忆
    2020-12-15 08:41

    All view functions must return some kind of HttpResponse object. There exists a code path in your function where None will be returned instead. This will occur when request.method != 'POST' and you'll simply "fall off the end" of your function (which will return None).

提交回复
热议问题