Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有为我做一些工作的中间件。是否可以将一些关于将要呈现的模板的数据传递给这个中间件?
让我们假设我有网址:
url(r'^some/$', direct_to_template, {'template': 'some.html'}, name='community', kwargs={'value': 'value'}),
我想将价值传递给中间件。是否可以?
是的,您可以查看https://docs.djangoproject.com/en/1.4/topics/http/middleware/#process-view中的视图 kwargs