django - 将参数从视图传递到 context_processors
问题描述
我有以下结构
民意调查/context_processors.py:
def link_list(request,link):
link = link
data = Page.objects.filter(link=link)
return {'link':data}
民意调查/views.py:
...
content = {
'content':content
}
link = request.POST["link"]
template = loader.get_template('pages/pages.html')
response = HttpResponse(template.render(content , request))
return response
我想要做的是从视图发送一个参数(可能会根据特定情况为每个页面设置),并且我想将此参数传递给 context_processors,因为我想在“pages/pages.html”模板之外使用模板标签
这可能吗 ?
解决方案
推荐阅读
- python-3.x - 如何创建一个比较两个单词相同的类(OOP),即使它们是字谜
- java - java.io.IOException:没有更多文件 - (将 pdf 复制到另一个位置时)
- ms-release-management - 如何在 TFS 发布定义中并行执行一组任务
- json - 2 API的数据访问困难 使用ForkJoin访问
- r - 是否有使用 FactoMineR(或任何其他包)绘制对应分析的第三维的 R 函数?
- html - HTML/JS 为什么包含一个复选框打破行高垂直文本居中
- python-3.x - 将 perl 转换为 python3
- ios - 将评论子项添加到帖子的数据结构中
- html - 是否有将导航栏移动到标题图形下方的代码?
- python - 列表未以预期方式被覆盖