How do you handle domain logic that spans multiple model objects in an ORM?
- by duality_
So I know that business logic should be placed in the model. But using an ORM it is not as clear where I should place code that handles multiple objects.
E.g. let's say we have a Customer model which has a type of either sporty or posh and we wanted to customer.add_bonus() to every posh customer. Where would we do this? Do we create a new class to handle all this? If yes, where do we put it (alongside all the other model classes, but not subclass it from the ORM?)?
I'm currently using django framework in python, so specific suggestions are even more wanted.