【问题标题】:Invalid block tag: 'bootstrap_icon', expected 'endblock'无效的块标签:“bootstrap_icon”,预期为“endblock”
【发布时间】:2015-04-19 20:09:28
【问题描述】:

我正在尝试在我的项目中使用 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 %}

但我明白了

无效的块标签:'bootstrap_icon',应为'endblock'

错误。

{% load bootstrap3 %}
{% bootstrap_css %}
{% bootstrap_javascript %}

位于 base.html 文件中。

【问题讨论】:

    标签: python django python-2.7


    【解决方案1】:

    您应该在模板中加载{% 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 %}
    

    【讨论】:

      猜你喜欢
      • 2012-02-07
      • 1970-01-01
      • 2012-05-03
      • 1970-01-01
      • 2014-01-06
      • 1970-01-01
      • 2018-09-01
      • 2015-02-10
      • 2012-03-09
      相关资源
      最近更新 更多