本文整理匯總了Python中db.DB.get_sale方法的典型用法代碼示例。如果您正苦於以下問題:Python DB.get_sale方法的具體用法?Python DB.get_sale怎麽用?Python DB.get_sale使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類db.DB
的用法示例。
在下文中一共展示了DB.get_sale方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: change_sale
# 需要導入模塊: from db import DB [as 別名]
# 或者: from db.DB import get_sale [as 別名]
def change_sale(request, id_of_sale):
if request.method == 'POST':
db = DB()
holiday = 0
weekend = 0
if request.POST.get('Holiday'):
holiday = 1
if request.POST.get('Weekend'):
weekend = 1
db.change_sale(int(id_of_sale), str(request.POST['ProductName']), str(request.POST['CategoryName']), int(request.POST['ProductPrice']),
int(request.POST['LineItemQuantity']), int(request.POST['LineItemDiscount']), str(request.POST['ContactName']),
str(request.POST['Address']), int(request.POST['Phone']), str(request.POST['TheDate']),
int(holiday), int(weekend), str(request.POST['Comment']),)
return HttpResponseRedirect('/sale/list/')
else:
db = DB()
sale = db.get_sale(int(id_of_sale))
return render(request, 'sale_change.html', {'sale': sale})
示例2: get_sale
# 需要導入模塊: from db import DB [as 別名]
# 或者: from db.DB import get_sale [as 別名]
def get_sale(request):
if request.method == 'POST':
db = DB()
sale = db.get_sale(int(request.POST['sale_id']), )
return render(request, 'sale_change.html', {'sale': sale})
return render(request, 'sale_get.html',)