update accounting dialog
This commit is contained in:
@@ -41,6 +41,16 @@ class AccountingView(generic.ListView):
|
||||
def get_queryset(self):
|
||||
return Accounting.objects.filter(billed=False).exclude(time_to__isnull=True)
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
result = super(AccountingView, self).dispatch(request, *args, **kwargs)
|
||||
acc_sum = self.get_queryset().aggregate(Sum('prize'))
|
||||
if acc_sum['prize__sum'] is None:
|
||||
result.context_data['acc_sum'] = 0
|
||||
else:
|
||||
result.context_data['acc_sum'] = acc_sum['prize__sum']
|
||||
result.context_data['acc_ids'] = [acc.id for acc in self.get_queryset().all()]
|
||||
return result
|
||||
|
||||
|
||||
# TODO OLD CODE, CLEAN UP
|
||||
|
||||
|
||||
Reference in New Issue
Block a user