[Fixed]-Return calculated value from Model manager?

1👍

try this

return self.get_queryset()
.filter(is_active = True)
.aggregate(total_inventory=Sum('inventory__quantity'))
.get('total_inventory')

Leave a comment