small fix

This commit is contained in:
a.feteleu 2020-01-16 15:30:37 +03:00
parent e9f07a4aa0
commit 14f19b2b4d

View File

@ -71,5 +71,5 @@ class NewsDocument(Document):
The related_models option should be used with caution because it can lead in the index
to the updating of a lot of items.
"""
if isinstance(related_instance, models.NewsType):
if isinstance(related_instance, models.NewsType) and hasattr(related_instance, 'news_set'):
return related_instance.news_set.all()