Django之旅:第七节--模版继承

定义母版---new.html

html 复制代码
<!DOCTYPE html>
<html lang="en">
    <head></head>
    <body>
        <div>
            {% block contents %}
            {% endblock %}
        </div>

    </body>
</html>

继承母模板

html 复制代码
{% extends 'new.html' %}
{% block contents %}
    <h1>首页</h1>
{% endblock %}

注:{% block contents %} 中,是自由定义的,只要和子模板里面相对应即可。

相关推荐
Gauss松鼠会12 小时前
Prometheus 实现 openGauss 的指标监控(二)Prometheus 中添加 openGauss指标
网络·数据库·oracle·prometheus·opengauss·经验总结
Cloud云卷云舒12 小时前
PolarDB(阿里云)VS HaishanDB(海山数据库,移动云)的AI能力全面对比
数据库·阿里云·ai-native·polardb·haishandb
我是人✓13 小时前
SQL主键与外键
java·数据库
飞翔的馒13 小时前
浏览器缓存之【结构化数据库与缓存】: IndexedDB、Cache storage 和 Storage buckets
数据库·缓存
SelectDB13 小时前
SelectDB search():AI 日志搜索与分析场景的技术能力与实践
数据库
SelectDB13 小时前
Apache Doris 事务保障:技术能力、选型对比与企业实践
数据库
SelectDB13 小时前
AI Observe Stack(基于 Apache Doris):AI Agent 可观测性技术能力、选型对比与实践
数据库
SelectDB13 小时前
PostgreSQL + Apache Doris HTAP 架构:技术能力、选型对比与企业实践
数据库
SelectDB13 小时前
SelectDB(飞轮科技)技术研发型企业认证:Apache Doris 核心能力、选型对比与实践
数据库