I have a view that displays a list of models. Some properties of some models need to be updated after the presentation has been visualized, that is, it is expected that the user will see the original unchanged values on the first visit and updated values on subsequent visits (or when the page reloads).
I thought I could achieve this with general class representations. The official documentation points to “doing extra work before or after invoking the general view” (my emphasis), but all the above examples affect the models before they are displayed.
I searched for signals, but to no avail.
The appearance of an asynchronous task is an option, but since all I need to do is update the field in several models (probably one or nothing) and save them, it seems to be too difficult for this task.
You can use the ajax request to start the update, or you can use your own template tag to display the corresponding fields and update them after that. I don't like this because they move the application logic to the presentation layer. The ajax method also adds the overhead of the second request.
But I seem to have no other choice, or am I? Is there a more practical method for connecting to a generic view or query and executing additional logic after rendering the template?
source
share