Access to Request.user from the Django model
📁 method, Advanced Python Topics, django
I am writing a site in Django. There is a problem: there is a Client model, and almost everywhere on the site the user should see only their clients. At first, I wrote in every form like this:
Client.objects.filter(user=request.user)
Then I made a manager with a method that requires passing the user, but in general this does not solve the problem of constantly passing the user. How can I make the current user available in models.py?