I have a Generic ListView, each item in my html list links to a DetailView.
Now I’d like to increment the MyModel(DetailView) object “views”-field (integerfield) on each click.
All I seem to have at hand in the DetailView is get_context_data? So how do I update my model on this action?
n.b. Thinking out loud, should this be middleware functionality?
edit
Ok it seems I do have get_object and get_queryset available but those are empty (print kwargs).. also updating the integer field in context data (which seems ugly and unwanted) runs 3 times on one click (3, 6, 9 etc)
You can indeed do it in get_object method, like this: