J
J
Jekson2020-01-17 13:52:24
Django
Jekson, 2020-01-17 13:52:24

Editing individual model fields on the same page?

I have not encountered a similar problem, I ask for tips on how this is implemented. DRF + React project. There is a page that displays information about the object. The page displays all the fields of the model. It is necessary to make it so that each field would be edited separately. For example, we take the Country field, click on the USA value on the right, and on clicking, an edit field appears. Enter a new value. The second nuance is that saving occurs not by clicking on the save button, but to any place on the page outside the input field.
For the standard way, I would use the RetrieveUpdateAPIView, or the UpdateModelMixin mixin. And what is there to expect? Unfortunately, there is no code yet, since the task is at the analysis stage.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Tikhonov, 2020-01-17
@Lepilov

Send a PATCH with the changes, on the DRF side this is called a partial_update.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question