Hi,
Thank you for your response, this works perfectly!
Patrick
On Thursday, February 2, 2017 at 4:07:21 AM UTC+11, pradam.programming
wrote:
>
> Hi Patrick,
> you can do like this:
> def total(self):
> return ContractItem.objects.filter(contract__subbudget__budge__in=
> self.budget_set.
Hi Patrick,
you can do like this:
def total(self):
return ContractItem.objects.filter(contract__subbudget__budge__in=
self.budget_set.all()).aggregate(Sum('total'))['total__sum']
try like this..!
On Wed, Feb 1, 2017 at 7:14 PM, Patrick Joy wrote:
> Hi all,
>
> Would appreciate some advi
from django.db.models import Q
def total(self):
subbudgets = SubBudget.objects.filter()
contracts = Contract.objects.filter(subbudget__in=subbudgets)
return
ContractItem.objects.filter(contract__subbudget__budget__in=self.budget_set.
all()).aggregate(Sum('total'))['total__su
Hi all,
Would appreciate some advice on this, I'm having trouble working out the
best way to aggregate across multiple foreign key relationships. I have
come up with the solution below however I'm not sure if this is the correct
way to handle this situation. Any advice would be appreciated.
Th
4 matches
Mail list logo