我想訪問產品屬性的值。我已經使用代碼weight
和類型float
定義了產品屬性。在我的意見,我想如下訪問:訪問django oscar產品屬性
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'
我試圖尋找到奧斯卡的模式,但無法找到解決方案。請幫忙。