Let's say I have two classes: class Account(models.Model): ... current_balance = models.DecimalField(max_digits=12, decimal_places=2) ...
class Transaction(models.Model): ... account = models.ForeignKey(Account) amount = models.DecimalField(max_digits=12, decimal_places=2) ... When a new transaction is entered, I would like to add the Transaction amount to the current_balance of the related Account. So I tried to define a save method: class Transaction(models.Model): ... def save(self): self.account.current_balance = self.account.current_balance + self.amount super(Transaction, self).save() This does not work. How do I access the 'current_balance' property of the related 'Account' instance? Is there a better way to do this? thanks in advance, -cjl --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---