If I have a hierarchy of models such that: class A(models.Model): name = CharField(max_length=10)
class B(models.Model): name = CharField(max_length=10) a= ForeignKey(A) class C(models.Model): name = CharField(max_length=10) b= ForeignKey(B) If I have an instance of C, as returned by: c = C.objects.get(pk=1) How do I get the name of A? I realise I can go via B, but I am hoping to be able to follow the chain back to A from any arbitrary point in (a much longer) chain. For example: If this was repeated up to F in an identical manner. If I pass a function any instance from A to F I would want to return A.name. I am sure there must be a simple way to get the root data, but I am having trouble finding it. Kind Regards Stephen -- 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.