[Answer]-Django: Button that updates database without redirection

1👍

Yes, as long as your view returns a 204 No Content response:

return HttpResponse(status=204)

A 204 response tells your browser to not change the current page, because no new content has been returned.

If the client is a user agent, it SHOULD NOT change its document view from that which caused the request to be sent. This response is primarily intended to allow input for actions to take place without causing a change to the user agent’s active document view, although any new or updated metainformation SHOULD be applied to the document currently in the user agent’s active view.

Emphasis mine.

Leave a comment