Pass data to middleware
-
10-06-2021 - |
Question
I have middleware which do some work for me. Is it possible to pass some data to this middleware in respect to template which will be rendered?
Lets assume that I have urls:
url(r'^some/$', direct_to_template, {'template': 'some.html'}, name='community', kwargs={'value': 'value'}),
and I would like to pass value to middleware. Is it possible?
Solution
Yes you can look at view kwargs in https://docs.djangoproject.com/en/1.4/topics/http/middleware/#process-view
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow