I have two models "Deposit" and "Cheque". I'm trying to show total
the amount of cheques in the admin area using the method name in the
list_display. It seems to work (although I think the documentation
suggests it may not because it requires the lookup for each row
shown).
I've got this in the admin.py
class DepositAdmin(admin.ModelAdmin)
list_display = ('date', 'cash', 'ChequeTotal')
and in the Deposit model:
def chequeTotal(self):
return '%s' % Cheque.objects.aggregate(cheque_sum=Sum('amount'))
The problem I'm having is that it is displayed as:
{'cheque_sum': Decimal('123.12')}
in the list. How do I get that to display just the 123.12?
I know this is likely a simply python question, but not sure what that
returned format is called in order to search accordingly for an
answer.
Thank you.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---