本文整理匯總了Python中orders.models.Order.view_order_total_in_usd方法的典型用法代碼示例。如果您正苦於以下問題:Python Order.view_order_total_in_usd方法的具體用法?Python Order.view_order_total_in_usd怎麽用?Python Order.view_order_total_in_usd使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類orders.models.Order
的用法示例。
在下文中一共展示了Order.view_order_total_in_usd方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: process_order
# 需要導入模塊: from orders.models import Order [as 別名]
# 或者: from orders.models.Order import view_order_total_in_usd [as 別名]
def process_order(request):
context = RequestContext(request)
user = request.user
increment_clicks(user)
profile = get_associated_profile(user)
cart = get_cart(profile)
items_to_package = []
total_price = 0
for item in CartItem.objects.all():
if item.cart == cart:
items_to_package.append(item.item)
total_price = total_price + item.item.price
entry_id = request.POST.get('entry_id')
entry = Entry.objects.get(id=entry_id)
new_order = Order(user_profile=profile,
restaurant=profile.restaurant,
total = total_price,
entry = entry,
status = 'PDG',
order_success = False,
order_rating = 0
)
new_order.save()
order_dict = {}
for item in items_to_package:
if item.id in order_dict.keys():
order_dict[item.id] = order_dict[item.id] + 1
else:
order_dict[item.id] = 1
order_items = []
for key in order_dict.keys():
item = Item.objects.get(id=key)
quantity = order_dict[key]
new_order_item = OrderItem(item=item,
order=new_order,
quantity=quantity)
new_order_item.save()
order_items.append(new_order_item)
#cart.delete()
#print order_dict.keys()
cart_id = cart.id
#print cart.id
total_price_display = new_order.view_order_total_in_usd()
return render_to_response("confirm.html", {'total_price_display':total_price_display,
'total_price':total_price,
'user':user,
'profile':profile,
'order_items':order_items,
'cart_id':cart_id }, context)