Return all related objects pointing to the current model. The related objects can come from a one-to-one, one-to-many, or many-to-many field relation type. Private API intended only to be used by Django itself; get_fields() combined with filtering of field p
(self)
| 616 | |
| 617 | @cached_property |
| 618 | def related_objects(self): |
| 619 | """ |
| 620 | Return all related objects pointing to the current model. The related |
| 621 | objects can come from a one-to-one, one-to-many, or many-to-many field |
| 622 | relation type. |
| 623 | |
| 624 | Private API intended only to be used by Django itself; get_fields() |
| 625 | combined with filtering of field properties is the public API for |
| 626 | obtaining this field list. |
| 627 | """ |
| 628 | all_related_fields = self._get_fields( |
| 629 | forward=False, reverse=True, include_hidden=True |
| 630 | ) |
| 631 | return make_immutable_fields_list( |
| 632 | "related_objects", |
| 633 | ( |
| 634 | obj |
| 635 | for obj in all_related_fields |
| 636 | if not obj.hidden or obj.field.many_to_many |
| 637 | ), |
| 638 | ) |
| 639 | |
| 640 | @cached_property |
| 641 | def _forward_fields_map(self): |
nothing calls this directly
no test coverage detected