'dict' Object Has No Attribute 'order_by' Django
i want to return a ManyToMany fields data , and also i've used aggregate to some calculation , now i need to return products as well this is my models.py class CustomerInvoice(mode
Solution 1:
Flip your approach. Instead of going from CustomerInvoice to ProductSelecte, do it from ProductSelecte to CustomerInvoice
ProductSelecte.objects.filter(products__customer=self.object.name)
Now you have every purchase from a customer with the name of the item and the quantity
Now use aggregation on this query to get them per-invoice if you really need that
Post a Comment for "'dict' Object Has No Attribute 'order_by' Django"