0
タイトルが誤解を招く場合は、ごめんなさい。ボタンを生成するためのhtmlの一意のID
次の問題が発生しています。私はGenshiを使用してHTMLで複数の行を作成しています。各行には、削除の目的で行の最後にボタンがあります。
コードは次のようになります
<form action="/deleteAusleihe" method="post">
<table>
<tr>
<th>ID</th>
<th>Person</th>
<th>Buch</th>
<th></th>
</tr>
<tr py:for="v in verleihen">
<input type = "hidden" value="v.id" name="toDelete"/>
<td py:content="v.id">Vorname der Person</td>
<td py:content="v.kundeID">Name der Person</td>
<td py:content="v.buchID">Straße der Person</td>
<td>
<input type="submit" name="submit" value="Löschen"/>
</td>
<br/>
</tr>
</table>
</form>
入力タイプは=「隠れた」各IDの値を格納しなければならないので、私は後に行を識別することができています。
私が今削除しようとすると、2行がいっぱいになっていると仮定すると、私は論理的な2つのIDをパラメタとして取得しますが、解決方法はわかりません。あなたの助けを事前に
@expose()
def deleteAusleihe(self,toDelete,submit):
Verleih1 = DBSession.query(Verleih).filter_by(id=toDelete)
for v in Verleih1:
DBSession.delete(v)
DBSession.flush()
transaction.commit()
redirect("/Verleih")
ありがとう:
deleteAusleihe機能は、次のようになります!
+1