海,所以我試圖在我的加入列中增加一個數字( 1),點擊燒瓶,到目前為止我已經完成了這個
@app.route("/joins/<name>", methods=["POST"])
def joins(name):
namess = name
owner = users.query.filter_by(name=namess).first()
if owner is not None:
#making the joins 1 if the value is already 1
owner.joins = 1
db.session.commit()
return redirect("/")
else:
return "You are not the owner of this url"
但這并沒有增加數量我該如何解決這個快樂的編碼!
uj5u.com熱心網友回復:
線
owner.joins = 1
是有效的python,但我認為這不是你想要的。它只是將 1 分配給owner.joins. 如果你想增加你需要這樣做:
owner.joins = owner.joins 1
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/425137.html
上一篇:如何在燒瓶中進行分頁
