[Answer]-Java's "UserContext" equivalent in Django

1👍

The plain answer is that django-tls (https://github.com/aino/django-tls) can make request available everywhere where you import it, and then you can just set attributes on request, request.user, or something similar.

That said, in 99% of the cases this is a bad idea, for instance if all you need it for is to avoid passing values to functions then it’s extremely ill advised. You’ll just make your code unreadable. If you have a lot of variables to pass around, maybe some of them need combining into some class?

Leave a comment