【问题标题】:Django use Admin TemplateDjango 使用管理模板
【发布时间】:2017-08-17 10:29:55
【问题描述】:

我创建了以下简单模板:

<!DOCTYPE html>
<html lang="en">
<head> .... </head>
<body>
<h1>Harvester: {{ harvester_name }} </h1>
 <textarea rows="10" cols="50">
 {{ log_text }}
 </textarea>
 </body>
 </html>

在路径myProject/myApp/templates/myApp中创建 现在我想为我的模板使用管理模板。 这样我就有了类似于 change_form 中使用的标题。 如图所示。

我该怎么做?

提前致谢

【问题讨论】:

    标签: python-3.x django-templates django-admin


    【解决方案1】:

    将此添加到您的模板中,在顶部。 Documentation

    {% extends "admin/change_form.html" %}
    
    {% block content %}
        Your stuff here
    {% endblock %}
    

    【讨论】:

      猜你喜欢
      • 2013-06-18
      • 2023-03-23
      • 2011-03-12
      • 1970-01-01
      • 1970-01-01
      • 2013-01-23
      • 2017-04-10
      • 2016-01-03
      • 2010-12-12
      相关资源
      最近更新 更多