1👍
✅
There may be a better way, but the way I do it is first get the warehouse object
warehouse_1=Warehouse.objects.get(id=1)
and now get the quantity
from ProductStock
products=ProductStock.objects.filter(warehouse=warehouse_1)
Then you can loop through this resulting query set to get what you want
for product in products:
if product.subcategory.id != '10':
print str(product.product.name) + " " + str(product.quantity)
Does that work?
Source:stackexchange.com