【发布时间】:2021-12-12 13:17:09
【问题描述】:
我有两个不同的模板,必须在三个不同的页面中扩展。
有没有用if block 扩展模板的解决方案?
我试过这个没有成功。
{% if 'project' in request.get_full_path %}
{% extends 'index.html' %}
{% elif 'network' in request.get_full_path %}
{% extends 'base.html' %}
{% elif 'zoneset' in request.get_full_path %}
{% extends 'base.html' %}
{% endif %}
{% load crispy_forms_tags %}
{% block title %} Network {% endblock title %}
{% block content %}
<div class="row">
<div class="col-md">
<div class="card card-body">
<h6>Update</h6>
<form class="" action="" method="post" enctype="multipart/form-data">
{% csrf_token %}
{{form|crispy}}
<input type="submit" name="" value="Update">
</form>
</div>
</div>
</div>
{% endblock %}
【问题讨论】:
标签: python django django-templates