我正在尝试使用 django-bootstrap3与我的项目打包。
我的模板是这样构建的:
{% extends "base.html" %}
{% block content %}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{% bootstrap_icon "star" %} All customers</h3>
</div>
<div class="panel-body">
All your customers are listed here in alphabetical order. In this panel you can update and delete
your customer informations.
</div>
</div>
{{ customers }}
{% endblock %}
但是我得到了
Invalid block tag: 'bootstrap_icon', expected 'endblock'
错误。
{% load bootstrap3 %}
{% bootstrap_css %}
{% bootstrap_javascript %}
在 base.html 文件中。
最佳答案
您应该在模板中加载 {% load bootstrap3 %}
。
{% extends "base.html" %}
{% load bootstrap3 %}
{% block content %}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{% bootstrap_icon "star" %} All customers</h3>
</div>
<div class="panel-body">
All your customers are listed here in alphabetical order. In this panel you can update and delete
your customer informations.
</div>
</div>
{{ customers }}
{% endblock %}
关于python - 无效的 block 标记 : 'bootstrap_icon' , 预期 'endblock',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28590149/