With context_processors it' s easy to define a callable which results variables available to all the templates. Is there any similar technique which makes a variable available to all the views? Is that somehow possible? Maybe with some workaround?
Django: 2.2 Python: 3.5.3
.
You may want to implement a custom Middleware.
https://docs.djangoproject.com/en/dev/topics/http/middleware/
This lets you execute custom code for every request and attach the results to the request
object, which is then accessible in your view.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With