-3
我應用此代碼從表中獲取id。從django數組中獲取特定值
getItemid=cursor.execute("Select id from shop_carthistory where order_id =%s",[order.order_number])
row=cursor.fetchall()
context = {order_id": row }
{{order_id}} gives => ((37L,),)
我只需要37出來的
你爲什麼要使用原始SQL,而不是ORM?如果你只需要一個結果,你爲什麼使用'fetchall()'? – 2013-05-14 12:11:16
...什麼是你的問題? – 2013-05-14 12:30:06