I am working on a project using django-rest-framework 2.6 (we are planning to update to a newer version of the code, but that is not an option at this moment in time). We have many models and a request has come in to log when data is changed. In the module that is dealing with this, I am subscribing to changes in the models we want to check, however the one bit of data that I lack is the user that made the request.
I think I can adjust all the models to have a non database field that contains the user-id, and then write in each of the serialisers to populate it from the request, but I worry about repeating code in all of those places, and someone fixing a bug in one place but not other and it ending up a mess.
Is there a more elegant way to do this?