Get nth parent in DJANGO -
i have models this:
a->b->c->d
b
parent of a
, c
parent of b
...
i have a
object database. best way related d
object a
object?
to retrieve instance of d
instance of a
:
d_instance = a_instance.b.c.d
where a_instance
instance of class a
.
whether "best way" question; depends on mean "best". performance-wise depends on how data structured.
remember join effected each time entity (or parent) accessed using dot notation shown above.
Comments
Post a Comment