【发布时间】:2014-07-29 07:42:31
【问题描述】:
创建模块化模板的最佳方法是什么?
例如,如果我有这样的事情:
#base file:
{header}
{block content}
{footer}
#main file:
{extends base}
{block content definition}
#product file:
{extends base}
{block content definition}
这是我所理解的 django 方式 - 填补空白。
现在,我的问题是如果我需要这样的页面:
{header}
{main}
{product}
{footer}
基本上,main 和 product 都在基本文件中。我可以尝试深度继承(具有主页面,然后连续加载产品)但这不起作用,因为文件都定义了“内容”,这在 Django 中是不可能的
【问题讨论】:
标签: django python-3.x