diff --git a/apps/news/models.py b/apps/news/models.py index fc07d4cd..e99e7785 100644 --- a/apps/news/models.py +++ b/apps/news/models.py @@ -121,7 +121,8 @@ class News(BaseAttributes, TranslatedFieldsMixin): return news_list @property - def on_the_same_theme_news(self): + def same_theme(self): + # on the same theme news # without "distinct" method the doubles are arising like_news = News.objects.published().filter(news_type=self.news_type, tags__in=models.F("tags"))\ @@ -137,7 +138,8 @@ class News(BaseAttributes, TranslatedFieldsMixin): return news_list @property - def you_should_read_news(self): + def should_read(self): + # you should read news # without "distinct" method the doubles are arising like_news = News.objects.published().filter(news_type=self.news_type).exclude(id=self.id).distinct() @@ -151,4 +153,4 @@ class News(BaseAttributes, TranslatedFieldsMixin): news_list = [{"id": like_news[r].id, "slug": like_news[r].slug} for r in random_ids] - return news_list \ No newline at end of file + return news_list diff --git a/apps/news/serializers.py b/apps/news/serializers.py index a36279b9..c3ca3863 100644 --- a/apps/news/serializers.py +++ b/apps/news/serializers.py @@ -64,9 +64,8 @@ class NewsDetailSerializer(NewsBaseSerializer): 'is_publish', 'author', 'country', - # 'list_also_like_news', - 'on_the_same_theme_news', - 'you_should_read_news', + 'same_theme', + 'should_read', )