Hello, Here is an extremely simple scenario:
class Base(models.Model): f1 = models.CharField(max_length=64) class A(Base): f2 = models.CharField(max_length=64) class B(models.Model): f3 = models.CharField(max_length=64) b = models.OneToOneField('A', null=False, related_name="b_obj") If you then try and do "print A.objects.select_related('b_obj').query' it produces Traceback (most recent call last): File "<console>", line 1, in <module> File "django\db\models\sql\query.py", line 147, in __str__ sql, params = self.get_compiler(DEFAULT_DB_ALIAS).as_sql() File "django\db\models\sql\compiler.py", line 59, in as_sql self.pre_sql_setup() File "django\db\models\sql\compiler.py", line 33, in pre_sql_setup self.fill_related_selections() File "django\db\models\sql\compiler.py", line 616, in fill_related_selections chain = opts.get_base_chain(f.rel.to) File "django\db\models\options.py", line 440, in get_base_chain % model._meta.module_name) TypeError: 'a' is not an ancestor of this model Incidentally, if I try to actually evaluate the queryset it turns out, that no queries are run at all. Is it supposed to be like that? In plain SQL this would be an inner join from A to Base followed by a left outer join with B. Is it possible to make it work at all? If you don't derive A from Base, it works perfectly (creates a left outer join from A to B). I hope, this makes sense Mark -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.