【发布时间】:2021-04-23 05:37:04
【问题描述】:
我正在开发一个 Flask 项目,我在引导卡上显示来自数据库的用户信息。我正在使用 jinja2 循环对象状态
{% extends "base.html" %}
{% block content %}
{% if statuses %}
**{% for status in statuses %}**
<div class="container">
<div class="row mt-4">
<div class="col-sm-3">
<div class="card">
<img src="{{ url_for('static', filename='img/no_profile.jpg')}}" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">{{ status.username }}</h5>
<p class="card-text">{{ status.biography }}</p>
<a href="#" class="btn btn-primary">{{ status.interests }}</a></div>
</div>
</div>
</div>
</div>
{% endfor %}
{% else %}
<h2>There are no statuses</h2>
{% endif %}
{% endblock %}
但是我希望卡片并排出现,但它们正在堆叠从数据库 snapshot of how the image is coming out 获取的所有状态或条目
【问题讨论】:
标签: html css bootstrap-4 jinja2