[Answer]-Django exception_value error

0👍

You are posting raw JSON, not form-encoded data. You need to access request.body:

postdata = request.body
postdata = json.loads(postdata)

Note that this was called request.raw_post_data in versions before 1.4.

1👍

Looks like wrong indenting to me. The line where you start processing postdata is in the same indented block as the part where you return the HttpResponseBadRequest. Move the whole block one space to the left and it should work.

Btw. better use 4 spaces for one indent. This is usual practice in Python development. In any case: one space is too hard to read and debug.

Leave a comment