On Tue, 2008-07-01 at 19:41 +0200, Torsten Bronger wrote: > Hallöchen! > > I use the current SVN version of Django. > > Consider the following models: > > class Process(models.Model): > ... > > class SpecialProcess(Process): > ... > > class Sample(models.Model): > processes = models.ManyToManyField(Process) > ... > > Then I populate one sample with a lot of SpecialProcesses. Now, > when I try to walk through the processes of this sample with > > for process in sample.processes.all(): > print process.__class__.__name__ > > I get a lot of "Process" instead of "SpecialProcess". Apparently, > the popymorphic many-to-many relationsship is not fully resolved. > Am I doing something wrong or is it a limitation of Django?
Hi, this is a limitation of relational databases. Polymorphism and relational databases do not go well together. You can try accessing the process.specialprocess attribute -- if this process was indeed a SpecialProcess model, you'd get back the SpecialProcess class, and an error in every other case. Please note that this is documented behavior: http://www.djangoproject.com/documentation/model-api/#multi-table-inheritance Matthias --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---