首页 > 解决方案 > 将参数从视图传递到 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”模板之外使用模板标签

这可能吗 ?

标签: djangotemplates

解决方案


推荐阅读