search

Home  >  Q&A  >  body text

python - django multiple templates nested extends

There is now a page.
base.html
data.html

index.html

Now index.html extends base and blocks base information.
Here comes the problem. How to extend data.html? Django does not support the extends 2 syntax by default.

# index.html
{% extends "base.html" %}

{% block source %}

    {% extends "data.html" %}
    # 如何再继承一个模板然后渲染呢?
    # 如果这里 include data.html , view 传进来的context 不会生效
    
{% endblock %}

If you are new to Django, is it normal to need to render twice?

迷茫迷茫2826 days ago848

reply all(1)I'll reply

  • 迷茫

    迷茫2017-06-30 09:54:46

    include with

    reply
    0
  • Cancelreply