本文整理汇总了Python中models.Product.description方法的典型用法代码示例。如果您正苦于以下问题:Python Product.description方法的具体用法?Python Product.description怎么用?Python Product.description使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Product
的用法示例。
在下文中一共展示了Product.description方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Addproduct
# 需要导入模块: from models import Product [as 别名]
# 或者: from models.Product import description [as 别名]
def Addproduct(request):
form=ProductForm(request.POST or None)
if form.is_valid():
ModelName = form.cleaned_data['ModelName']
description = form.cleaned_data['description']
photo = form.cleaned_data['photo']
manufacturer = form.cleaned_data['manufacturer']
price_in_dollars = form.cleaned_data['price_in_dollars']
Quantity = form.cleaned_data['Quantity']
Serial_No =form.cleaned_data['Serial_No']
product=Product()
product.ModelName=ModelName
product.description=description
product.photo=photo
product.manufacturer=manufacturer
product.price_in_dollars=price_in_dollars
product.Quantity=Quantity
product.Serial_No=Serial_No
product.save()
return HttpResponseRedirect(reverse('ecom:product'))
#return HttpResponseRedirect(reverse('ecom:product'))
else:
return render(request,"ItemMaster.html",{"form":form})
示例2: create
# 需要导入模块: from models import Product [as 别名]
# 或者: from models.Product import description [as 别名]
def create(request, keyname):
"Backdoor to create a new entity"
u = auth.get_current_user(request)
if u.is_admin:
p = Product(key_name=keyname)
p.name = "New Product"
p.description = "The description"
p.put()
return HttpResponseRedirect(reverse('store-edit', args=(p.key(),)))
return HttpResponseRedirect(reverse('store-index'))
示例3: fetch_category
# 需要导入模块: from models import Product [as 别名]
# 或者: from models.Product import description [as 别名]
def fetch_category(search_index, amazon_node_id):
api = caching.ResponseCachingAPI(
settings.AMAZON_AWS_KEY,
settings.AMAZON_SECRET_KEY,
settings.AMAZON_API_LOCALE,
settings.AMAZON_ASSOCIATE_TAG,
cachedir='cache',
cachetime=86400)
try:
for root in api.item_search(search_index, BrowseNode=str(amazon_node_id),
ResponseGroup=settings.AMAZON_RESPONSE_GROUP):
for item in root.Items.Item:
product = Product()
product.category = Category.objects.get(amazon_node_id=amazon_node_id)
product.asin = item.ASIN
product.title = unicode(item.ItemAttributes.Title)
product.detailpageurl = unicode(item.DetailPageURL)
product.manufacturer = unicode(getattr(item.ItemAttributes, 'Manufacturer', None))
product.publisher = unicode(getattr(item.ItemAttributes, 'Publisher', None))
product.brand = unicode(getattr(item.ItemAttributes, 'Brand', None))
product.popularity = getattr(item, 'SalesRank', 1000)
if hasattr(item, 'MediumImage'):
product.medium_image = getattr(item.MediumImage, 'URL', None)
if hasattr(item, 'LargeImage'):
product.large_image = getattr(item.LargeImage, 'URL', None)
if hasattr(item, 'EditorialReviews'):
product.description = unicode(getattr(item.EditorialReviews.EditorialReview, 'Content', None))
if hasattr(item.Offers, 'Offer'):
product.price = item.Offers.Offer.OfferListing.Price.FormattedPrice.pyval
elif hasattr(item.ItemAttributes, 'ListPrice'):
product.price = item.ItemAttributes.ListPrice.FormattedPrice.pyval
elif hasattr(item.OfferSummary, 'LowestUsedPrice'):
product.price = u'used from %s' % item.OfferSummary.LowestUsedPrice.FormattedPrice.pyval
else:
product.price = None
product.save()
except AWSError, e:
if e.code == 'AWS.ParameterOutOfRange':
pass # reached the api limit of 10 pages
else:
raise ValidationError(message=e.msg)