[Answer]-Aggregate @property child fields?

1👍

It seems this is not directly possible with the aggregate function, so I solved it this way:

@property
def total_invoice_amount(self):
    total = 0

    for invoice_line in self.invoiceline_set.all():
        total += invoice_line.price_incl_vat

    return total
👤Peter

Leave a comment