Hi Folks,

I have a Donation object in my model which includes:

    amount = models.DecimalField(max_digits=12,decimal_places=2,core=True)
    patron = models.ForeignKey(Patron)

From my Patron object, I want to select the total donations for that patron, 
so something like:

def total_donation(self):
        lAllDonations = Donation.objects.filter(patron__id = 
self.id).iterator()
        lDonationSum = 0.00
        for lEachDonation in lAllDonations:
            lDonationSum = lDonationSum + lEachDonation.amount
        return lDonationSum

I can't get this to work, and I'm sure there's a better way anyway.

Any suggestions?

Thanks,

Tim.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to