BookofMorten
BookofMorten

Reputation: 142

Django views function without return value

I want to send information back-end via JS to update the database based on user response, but I don't need a JSON response or other HTTP rendering done. It's a test type app so all I'm sending back is a single identifier (integer) and boolean value to indicate pass/fail on their response.

Currently I am using a fetch(url/${identifier}/bool) and all works as intended with the data management, but Python/Django throws an error as I am not returning any value.

So I have two questions.

  1. Is fetch the right way of doing this as I am not actually expecting a response and I am doing no manipulation JS side with the data after calling it.

  2. How can I stop Django from expecting a response on this as I intend to run the call as a simple function rather than an API call with JSON response sent back.

Thank you for the help.

Upvotes: 2

Views: 1597

Answers (1)

BookofMorten
BookofMorten

Reputation: 142

Fixed the issue by simply using

return HttpResponse(status = 200)

Upvotes: 2

Related Questions