On Sat, Nov 10, 2012 at 6:15 AM, Tomas Ehrlich <tomas.ehrl...@gmail.com> wrote: > I usualy put methods like this one into Model, although Manager is also > possible. Definitely not View or sth else.
definitely in the model. you'd use it like this: accnt = get_object_or_404 (Account, pk=account_id) payee = get_object_or_404 (...........) accnt.make_payment (payee, amount) it would be as easy as adding a method to your Account class, for example: class Account (models.Model): ...... ...... def make_payment(self, payee, amount, save=True): if amount > self.balance: throw NotEnoughFunds self.balance -= amount payee.balance += amount if save: self.save() payee.save() (of course, a serious accounting app don't modify balances but registers debit/credit entries) -- Javier -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.