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


Python Order.items方法代码示例

本文整理汇总了Python中models.Order.items方法的典型用法代码示例。如果您正苦于以下问题:Python Order.items方法的具体用法?Python Order.items怎么用?Python Order.items使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Order的用法示例。


在下文中一共展示了Order.items方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: completeOrder

# 需要导入模块: from models import Order [as 别名]
# 或者: from models.Order import items [as 别名]
def completeOrder(request):
  request.session.set_expiry(0)
  cart = request.session['cart']
  order = Order()
  order.first_name = request.POST['first_name']
  order.last_name = request.POST['last_name']
  order.address = request.POST['address']
  order.city = request.POST['city']
  order.payment_method = request.POST['payment']
  order.payment_data = request.POST['payment_data']
  order.items = genItemsList(cart)
  request.session['cart'] = []
  return render(request, "complete_order.html", None)
开发者ID:hnejadi,项目名称:Python-Django-ecommerce-app,代码行数:15,代码来源:views.py

示例2: complete_order

# 需要导入模块: from models import Order [as 别名]
# 或者: from models.Order import items [as 别名]
def complete_order(request):
    request.session.set_expiry(0)
    cart = request.session["cart"]
    order = Order()
    order.first_name = request.POST["first_name"]
    order.last_name = request.POST["last_name"]
    order.address = request.POST["address"]
    order.city = request.POST["city"]
    order.payment_method = request.POST["payment"]
    order.payment_data = request.POST["payment_data"]
    order.items = gen_items_list(cart)
    request.session["cart"] = []
    return render(request, "mystore/complete_order.html", None)
开发者ID:bluehawk27,项目名称:estore,代码行数:15,代码来源:views.py

示例3: completeOrder

# 需要导入模块: from models import Order [as 别名]
# 或者: from models.Order import items [as 别名]
def completeOrder(request):
    cart = request.session['cart']
    request.session.set_expiry(0)
    ctx = {'cart':cart, 'cart_size':len(cart), 'cart_items':cartItems(cart), 'total_price': priceCart(cart)}
    order = Order()
    order.items = genItemsList(cart)
    order.first_name = request.POST['first_name']
    order.last_name = request.POST['last_name']
    order.address = request.POST['address']
    order.city = request.POST['city']
    order.payment_data = request.POST['payment_data']
    order.fulfilled = False
    order.payment_method = request.POST['payment']
    order.save()
    request.session['cart'] = []
    return render(request, "complete_order.html", ctx)
开发者ID:jakegny,项目名称:UdemyClasses,代码行数:18,代码来源:views.py

示例4: completeOrder

# 需要导入模块: from models import Order [as 别名]
# 或者: from models.Order import items [as 别名]
def completeOrder(request):
  cart = request.session.get('cart', [])
  total_price = request.session.get('total_price', 0.0)
  cart_items = cartItems(cart)
  items_str = ','.join(map(lambda i: i.name, cart_items))

  order = Order()
  order.total_price = total_price
  order.first_name = request.POST['first_name']
  order.last_name = request.POST['last_name']
  order.address1 = request.POST['address1']
  order.address2 = request.POST['address2']
  order.city = request.POST['city']
  order.postcode = request.POST['postcode']
  order.payment_type = request.POST['payment_type']
  order.payment_data = request.POST['payment_data']
  order.items = items_str
  order.fulfilled = False
  order.save()
  request.session['cart'] = []
  return render(request, 'complete_order.html', {'cart_size' : len(request.session['cart'])})
开发者ID:VampireTeeth,项目名称:simple_store,代码行数:23,代码来源:views.py


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