>  Q&A  >  본문

python - django模板 include模板的数据问题

如:views.py返回是return render(request, 'index.html')
而index.html内容是:

 {% include 'header.html' %}

然后header.html的内容可以是动态的吗?怎么写,谢谢!

{{text}}
PHP中文网PHP中文网2741일 전521

모든 응답(1)나는 대답할 것이다

  • ringa_lee

    ringa_lee2017-04-18 10:31:00

    헤더는 동적일 수 있지만 렌더링 시 동적 변수를 렌더링해야 합니다.
    예:

    • header.html

    으아악
    • index.html

    으아악

    회신하다
    0
  • 취소회신하다