本文整理汇总了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)