嘿,我正在尝试编写一个销售门票的平台,因此当我作为用户单击该活动时,我将被重定向到一个页面,其中将显示活动信息,包括价格和内容。就此而言,我试图打印该特定活动的门票给定价格,但没有成功,我尝试了很多方法,但这些是我编码的最终行。我非常了解如何在 python 中操作列表,但由于这是flask/sqalchemy,我有点困惑,因为门票必须是活动组织者将要设置的门票。
帖子.html
<div class="table-tickets col-lg-4 col-md-4 col-sm-12 col-xs-12 margin-top-20-xs margin-top-0-md">
<form method="POST" action="">
<table>
<tbody>
<tr class="title">
<th class="tg-031e" colspan="2">
<div class="row">
<div class="col-md-6 col-sm-6 col-xs-6 col lg-6">
<h4 class="kill-top-margin kill-bottom-margin"> Tickets</h4>
</div>
<div class="col-md-6 col-sm-6 col-xs-6 col lg-6">
{% for info in post.ticket %}
<h4 class="kill-top-margin kill-bottom-margin"> ${{ info }} </h4>
{% endfor %}
<h4 class="kill-top-margin kill-bottom-margin"> ${{ #priceoftheticket }} </h4>
</div>
</div>
</th>
</tr>
</tbody>
</table>
</form>
</div>
楷模
class Post(db.Model):
#unique id for the user
id= db.Column(db.Integer, primary_key=True)
#name of the event
title= db.Column(db.String(100), nullable=False)
#when the event was posted
date_posted= db.Column(db.DateTime, nullable=False, default=datetime.now())
#description of the event
content= db.Column(db.Text, nullable=False)
#start date and hour of the event
start_dh= db.Column(db.String(10), nullable=False, default=datetime.now())
#finish date and hour of the event
finish_dh= db.Column(db.String(10), nullable=False, default=datetime.now())
ABOUTYOU
相关分类