本文整理汇总了Python中models.Item.product_name方法的典型用法代码示例。如果您正苦于以下问题:Python Item.product_name方法的具体用法?Python Item.product_name怎么用?Python Item.product_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Item
的用法示例。
在下文中一共展示了Item.product_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_item
# 需要导入模块: from models import Item [as 别名]
# 或者: from models.Item import product_name [as 别名]
def set_item(request):
""" If item exists, update item. Else, create new item """
item = None
item_id = ora(request, "item_id")
#TODO: supplier = ora(request, "supplier_id")
if item_id:
try:
item = Item.objects.get(id=item_id)
except:
item = Item()
else:
item = Item()
item.product_name = osra(request, "product_name")
item.product_code = osra(request, "product_code")
item.supplier = Supplier.objects.get(email_addr=request.user.email_addr)
if ora(request, "in_stock"): item.in_stock = True
else: item.in_stock = False
item.lead_time = osra(request, "lead_time")
item.wholesale_price = osra(request, "wholesale_price")
item.wholesale_price_units = osra(request, "price_units")
item.volume_discount = osra(request, "volume_discount")
item.fabric_width = osra(request, "fabric_width")
item.fabric_width_units = osra(request, "width_units")
item.material_type = osra(request, "material_type")
item.fiber_type = osra(request, "fiber_type")
item.textile_type = osra(request, "textile_type")
item.weave_type = osra(request, "weave_type")
item.weight = osra(request, "weight")
item.weight_units = osra(request, "weight_units")
item.color = osra(request, "color")
item.country_origin = osra(request, "country_origin")
#TODO set image url image1_url
if request.FILES.get('image1'):
item = _add_image(request.FILES['image1'], request.user.email_addr, item)
if request.FILES.get('image2'):
item = _add_image(request.FILES['image2'], request.user.email_addr, item)
if request.FILES.get('image3'):
item = _add_image(request.FILES['image3'], request.user.email_addr, item)
if request.FILES.get('image4'):
item = _add_image(request.FILES['image4'], request.user.email_addr, item)
item.save()
return redirect("/mobile/product_list")