I have never used model inheritance, but I read the documentation.... If all worker classes (cook, waiter, ...) are subclassed from Worker, something like this should work: Worker.objects.filter(workplace=...)
(Given that workers only work for one workplace) HTH, Thomas Alistair Marshall schrieb: > Using the example in the django writing models documentation [1] I > wish to get a list of all the places, then calculate a value that > depends on what the type of place it is. > > Say in my restraunt I have a function get_workforce() which returns a > list of all the people that work in the restaraunt. This collects all > the waiters, cooks and managers that are associated with the > restraunt. > Then I have another type of place, a shop which also has a function > get_workforce() which returns a list of people that work in the shop. > This collects all the shop_assistants and managers associated with the > shop. > > The function is different depending on the type of subclass but I need > to be able to get access to it from a list of all the places. > > Has anyone come across this before and come up with a solution. > > Thanks > Alistair > > [1] http://docs.djangoproject.com/en/dev/topics/db/models/#id6 > > > -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---