fix names of methods and fields of serializer
This commit is contained in:
parent
055e99dba2
commit
a497230883
|
|
@ -121,7 +121,8 @@ class News(BaseAttributes, TranslatedFieldsMixin):
|
||||||
return news_list
|
return news_list
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def on_the_same_theme_news(self):
|
def same_theme(self):
|
||||||
|
# on the same theme news
|
||||||
|
|
||||||
# without "distinct" method the doubles are arising
|
# without "distinct" method the doubles are arising
|
||||||
like_news = News.objects.published().filter(news_type=self.news_type, tags__in=models.F("tags"))\
|
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
|
return news_list
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def you_should_read_news(self):
|
def should_read(self):
|
||||||
|
# you should read news
|
||||||
|
|
||||||
# without "distinct" method the doubles are arising
|
# without "distinct" method the doubles are arising
|
||||||
like_news = News.objects.published().filter(news_type=self.news_type).exclude(id=self.id).distinct()
|
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]
|
news_list = [{"id": like_news[r].id, "slug": like_news[r].slug} for r in random_ids]
|
||||||
|
|
||||||
return news_list
|
return news_list
|
||||||
|
|
|
||||||
|
|
@ -64,9 +64,8 @@ class NewsDetailSerializer(NewsBaseSerializer):
|
||||||
'is_publish',
|
'is_publish',
|
||||||
'author',
|
'author',
|
||||||
'country',
|
'country',
|
||||||
# 'list_also_like_news',
|
'same_theme',
|
||||||
'on_the_same_theme_news',
|
'should_read',
|
||||||
'you_should_read_news',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user