本文整理汇总了Python中products.models.Product.description方法的典型用法代码示例。如果您正苦于以下问题:Python Product.description方法的具体用法?Python Product.description怎么用?Python Product.description使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类products.models.Product
的用法示例。
在下文中一共展示了Product.description方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: saveProductData
# 需要导入模块: from products.models import Product [as 别名]
# 或者: from products.models.Product import description [as 别名]
def saveProductData(request, productForm):
product = Product()
product.name = productForm.cleaned_data['name']
product.description = productForm.cleaned_data['description']
product.q_amount = productForm.cleaned_data['q_amount']
user = request.user
product.id_owner = user
product.start_datetime = str(datetime.now())
product.end_datetime = str(datetime.now())
product.follower_qty = 0
product.visit_qty = 0
product.img = uuid.uuid1().hex
product.featured_time = 0;
product.active = 1
return product
示例2: index
# 需要导入模块: from products.models import Product [as 别名]
# 或者: from products.models.Product import description [as 别名]
def index(request, product_uuid=None):
product = None if not product_uuid else Product.objects.get(uuid=product_uuid)
if request.method == 'POST':
p = Product()
p.name = request.POST.get('name', None)
p.description = request.POST.get('description', None)
p.image_url = request.POST.get('image_url', None)
p.url = request.POST.get('url', None)
p.author = request.user if request.user.id else None
p.save()
if not product and Product.objects.count() != 0:
product = Product.objects.order_by('-created')[0]
ctx = {
'product': product,
'latest': Product.objects.order_by('-created')[:5],
}
return render_to_response('index.html', ctx, context_instance=RequestContext(request))
示例3: _product
# 需要导入模块: from products.models import Product [as 别名]
# 或者: from products.models.Product import description [as 别名]
def _product(self, item):
try:
product = Product.objects.get(wholesale_legacy_id=int(item['id']), is_visible=True)
except Product.DoesNotExist:
product = Product()
except Product.MultipleObjectsReturned:
print item['id']
for p in Product.objects.filter(wholesale_legacy_id=int(item['id'])):
print p.id, p.title, p.code, p.sku
print '-----'
raise
quantity = int(item.get('qtyi', 0))
if quantity < 0:
quantity = 0
weight = int(item.get('weight', 0))
if weight < 0:
weight = 0
product.sku = item['article']
product.weight = weight
product.quantity = quantity
product.code = item['link']
product.title = item['name']
product.description = item['descr']
product.is_visible = bool(int(item['pub']))
product.wholesale_legacy_id = item['id']
product.created = TIMEZONE.localize(datetime.datetime.fromtimestamp(int(item['dt'])))
size = None
try:
size = SIZE_RE.findall(u' '.join([item['name'], item.get('alt', ''), item['descr']]))[0]
except IndexError:
try:
size = SIZE2_RE.findall(u' '.join([item['name'], item.get('alt', ''), item['descr']]))[0]
except IndexError:
pass
if size:
product.size = u'×'.join([str(x) for x in size])
return product
示例4: _product
# 需要导入模块: from products.models import Product [as 别名]
# 或者: from products.models.Product import description [as 别名]
def _product(self, item):
try:
product = Product.objects.get(id=int(item['id']))
except Product.DoesNotExist:
product = Product(id=int(item['id']))
quantity = int(item.get('qtyi', 0))
if quantity < 0:
quantity = 0
weight = int(item.get('weight', 0))
if weight < 0:
weight = 0
product.sku = item['article']
product.weight = weight
product.quantity = quantity
product.code = item['link']
product.title = item['name']
product.description = item['descr']
product.is_visible = bool(int(item['pub']))
product.is_wholesale = False
product.created = TIMEZONE.localize(datetime.datetime.fromtimestamp(int(item['dt'])))
size = None
try:
size = SIZE_RE.findall(u' '.join([item['name'], item.get('alt', ''), item['descr']]))[0]
except IndexError:
try:
size = SIZE2_RE.findall(u' '.join([item['name'], item.get('alt', ''), item['descr']]))[0]
except IndexError:
pass
if size:
product.size = u'×'.join([str(x) for x in size])
return product