diff --git a/backend/api/posts/serializers.py b/backend/api/posts/serializers.py index 7052660..87c4935 100644 --- a/backend/api/posts/serializers.py +++ b/backend/api/posts/serializers.py @@ -105,9 +105,15 @@ class PostSerializer(serializers.ModelSerializer): } def get_description(self, obj) -> Dict[str, str]: + desc = obj.description.first().content + if desc == "": + count = 0 + else: + count = obj.description.count() + return { - "count": obj.description.count(), - "content": obj.description.first().content, + "count": count, + "content": desc, } def get_creator(self, obj) -> Dict[str, str]: