当前位置: 首页>>代码示例>>Python>>正文


Python Order.view_order_total_in_usd方法代码示例

本文整理汇总了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)
开发者ID:dsethan,项目名称:tripping-dangerzone,代码行数:64,代码来源:views.py


注:本文中的orders.models.Order.view_order_total_in_usd方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。