diff --git a/authors/apps/articles/models.py b/authors/apps/articles/models.py index 7c28e2b..6e63eba 100644 --- a/authors/apps/articles/models.py +++ b/authors/apps/articles/models.py @@ -298,7 +298,9 @@ def ratings(self, article_id, user): return { "average_ratings": Article().average_ratings(article_id) } - return 0 + return { + "average_ratings": 0 + } class CommentHistory(models.Model): diff --git a/authors/apps/articles/serializers.py b/authors/apps/articles/serializers.py index 30aa2f6..9dcd07a 100644 --- a/authors/apps/articles/serializers.py +++ b/authors/apps/articles/serializers.py @@ -127,7 +127,8 @@ class Meta: fields = ( 'slug', 'title', 'description', 'body', 'image', 'image_url', 'created_at', 'updated_at', 'author', 'ratings', 'tagList', - 'like_info', 'comments', 'favorites', 'readtime', 'bookmarked' + 'like_info', 'comments', 'favorites', 'readtime', 'bookmarked', + 'num_vote_up', 'num_vote_down' ) extra_kwargs = { 'image': {'write_only': True, 'required': False} diff --git a/authors/utils/notification_handlers.py b/authors/utils/notification_handlers.py index 8697637..7f6508d 100644 --- a/authors/utils/notification_handlers.py +++ b/authors/utils/notification_handlers.py @@ -26,13 +26,12 @@ def create_article_handler(sender, instance, created, **kwargs): article_author, title.upper(), instance.created_at.strftime('%d-%B-%Y %H:%M')) - + url = f"/post/{instance.slug}" + url = f"{settings.DOMAIN}{url}" if not followers: return for user in followers: if user.user.notification_preferences.in_app_notifications: - url = f"/post/{instance.slug}" - url = f"{settings.DOMAIN}{url}" notify.send( article_author, recipient=user.user,