How do you insert a template into another template?

前端 未结 4 890
猫巷女王i
猫巷女王i 2020-12-04 16:18

I have a very basic template (basic_template.html), and want to fill in the with data formatted using another partial template. The basic_template.html might contain severa

4条回答
  •  一向
    一向 (楼主)
    2020-12-04 17:00

    There are mainly 2 ways (2 easy ones)

    1:

    In base html put {% include "myapp/sub.html" %}

    And just write html code inside your sub.html file

    2:

    https://docs.djangoproject.com/en/dev/ref/templates/language/#template-inheritance

提交回复
热议问题