[Fixed]-How to filter on calculated model values using list comprehension

1👍

I doubt you can call F on model class methods. You can instead call the methods directly from the objects in the list comprehension:

po_list = [n for n in Material.objects.all() if (n.total_inventory['quantity__sum'] 
                                                 + n.total_po['quantity__sum'] 
                                                 - n.total_so['quantity__sum']) 
                                                 < n.min_quantity]

Leave a comment