Bootstrap 4 引导btn组出现问题,按钮在一个过长的行中

Bootstrap 4 引导btn组出现问题,按钮在一个过长的行中,bootstrap-4,django-templates,Bootstrap 4,Django Templates,我在django模板中查看很多按钮时遇到问题。所有的按钮都是dict的元素,我用for访问它们。问题是他们太多了,超过了他们所在的部门。有没有一种方法可以将它们放在彼此下方的许多水平线上,而不是放在一条太长的线上 我尝试使用btn组(因为之前按钮在垂直线上),这是我的代码: <div class="btn-group special d-flex btn-group-justified" role="group"> {% fo

我在django模板中查看很多按钮时遇到问题。所有的按钮都是dict的元素,我用for访问它们。问题是他们太多了,超过了他们所在的部门。有没有一种方法可以将它们放在彼此下方的许多水平线上,而不是放在一条太长的线上

我尝试使用btn组(因为之前按钮在垂直线上),这是我的代码:

<div class="btn-group special d-flex btn-group-justified"  role="group">
        {% for x in data %}
            {% with y=x.1  %}
                {% for key in dict %}
                    {% if key == y  %}
                        <p class="col-md-1">
                            <a class="btn btn-outline-dark w-100 btn-block" type="button"  aria-pressed="true" href="{% url 'detail' y %}" >{{ y }}</a>
                        </p>
                    {% endif %}
                {% endfor %}
            {% endwith %}
        {% endfor %}
    </div>

{数据%中x的%s}
{%y=x.1%}
{dict%中的键为%1}
{%if key==y%}

{%endif%} {%endfor%} {%endwith%} {%endfor%}