我想访问产品属性的值。我已经用 codeweight
和 type定义了一个产品属性float
。在我看来,我正在尝试按如下方式访问它:
def red(request):
basket = request.basket
weight_total = 0
for line in basket.all_lines():
weight = line.product.attributes.get(code = 'weight')
weight_total += weight.productattributevalue
它不起作用并给出错误:
'ProductAttribute' object has no attribute 'productattributevalue'
我试图研究 oscar 的模型,但找不到解决方案。请帮忙。