For my project I need to count distinct products that have a balance larger than $100.
The model kinda looks like this:
class Client(models.Model):
...
class Product(models.Model):
...
class ClientProduct(models.Model):
client = models.ForeignKey(Client)
product = models.ForeignKey(Product)
class Balance(models.Model):
clientproduct = models.ForeignKey(ClientProduct)
balance = models.DecimalField(max_digits=10, decimal_places=2)
but I'm clueless... And other related questions here in SO don't really address this scenario...
Please help.