check before get related_objects
This commit is contained in:
parent
c3cc87507e
commit
4ba2edecd0
|
|
@ -109,8 +109,9 @@ class Collection(ProjectBaseMixin, CollectionDateMixin,
|
|||
def _related_objects(self) -> list:
|
||||
"""Return list of related objects."""
|
||||
related_objects = []
|
||||
instances = self._meta.related_objects
|
||||
# get related objects
|
||||
for related_object in self._meta.related_objects.with_base_related():
|
||||
for related_object in instances.with_base_related() if hasattr(self, 'with_base_related') else instances:
|
||||
related_objects.append(related_object)
|
||||
return related_objects
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user