There are a couple things here to point out:
There’s no need to supply the csrf_token on a GET because the GET request is considered a “safe” method.
(It’s not an error to supply it, it’s just not being checked.)
-
You’re not doing anything with the response from the GET. You need to have some code that processes the response and injects it into the page. In this case, by probably changing the value of the form widgets being updated. (Don’t forget to update any hidden fields like the
id
.) -
Your view to retrieve this data should be a separate view that retrieves the specific data and returns it as a JSON object, not a fully-rendered page. Your JavaScript would accept this JSON object and use the values supplied to update the form fields.
An htmx version of this would have you render just the form portion as html, and the JavaScript would replace the form in the DOM with what the view has returned. But again, you’re not rendering a complete page - just the portion to be replaced from the original. But you don’t need to use HTMX to do this. You could handle this within your own JavaScript.