Return a list of parent classes leading to `model` (ordered from closest to most distant ancestor). This has to handle the case where `model` is a grandparent or even more distant relation.
(self, model)
| 695 | ) |
| 696 | |
| 697 | def get_base_chain(self, model): |
| 698 | """ |
| 699 | Return a list of parent classes leading to `model` (ordered from |
| 700 | closest to most distant ancestor). This has to handle the case where |
| 701 | `model` is a grandparent or even more distant relation. |
| 702 | """ |
| 703 | if not self.parents: |
| 704 | return [] |
| 705 | if model in self.parents: |
| 706 | return [model] |
| 707 | for parent in self.parents: |
| 708 | res = parent._meta.get_base_chain(model) |
| 709 | if res: |
| 710 | res.insert(0, parent) |
| 711 | return res |
| 712 | return [] |
| 713 | |
| 714 | @cached_property |
| 715 | def all_parents(self): |
no test coverage detected