From be793eed73658727fb66da7e75b2284634247e35 Mon Sep 17 00:00:00 2001 From: Kuroshini Date: Mon, 9 Dec 2019 17:40:05 +0300 Subject: [PATCH] fix issue w/ tags binding --- apps/search_indexes/documents/tag_category.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/search_indexes/documents/tag_category.py b/apps/search_indexes/documents/tag_category.py index 3c335cdf..cd2c8a90 100644 --- a/apps/search_indexes/documents/tag_category.py +++ b/apps/search_indexes/documents/tag_category.py @@ -32,3 +32,11 @@ class TagCategoryDocument(Document): def get_queryset(self): return super().get_queryset().with_base_related() + + def get_instances_from_related(self, related_instance): + """If related_models is set, define how to retrieve the Car instance(s) from the related model. + 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, News): + return related_instance.tags \ No newline at end of file