I have dict like {product_id: count}
.
For example {1: 150}
. This dict represents customer basket.
I also have product model with count field. It’s representing stock balances.
I want to get products that is in dict and update their quantity according to values in dict.
I get products like this :
products = Product.objects.filter(id__in=cart_items)
And I want to update the quantity like this:
products.update(count=dict.get(F(id))
But it doesn’t work.
Thx!
1