class PopulatedPlantSerializer(PlantSerializer): comments = PopulatedCommentSerializer(many=True) categories = CategoriesSerializer(many=True) owner = UserSerializer()
class PopulatedCategorySerializer(CategorySerializer): comments = PopulatedCommentSerializer(many=True)
class PopulatedArticleSerializer(ArticleSerializer): comments = PopulatedCommentSerializer(many=True) types = ArticleTypeSerializer(many=True) owner = UserSerializer() favorites = UserSerializer(many=True)
class PopulatedSkillSerializer(SkillSerializer): comments = PopulatedCommentSerializer(many=True) owner = UserSerializer()
class PopulatedPokemonSerializer(PokemonSerializer): comments = PopulatedCommentSerializer(many=True) types = PokemonTypeSerializer(many=True) owner = NestedUserSerializer() favorited_by = NestedUserSerializer(many=True)
class PopulatedLoopSerializer(LoopSerializer): owner = UserSerializer() comments = PopulatedCommentSerializer(many=True) likes = PopulatedLikeSerializer(many=True) genres = GenreSerializer(many=True)
def get(self, _request): comments = Comment.objects.all() serialized_comments = PopulatedCommentSerializer(comments, many=True) return Response(serialized_comments.data, status=status.HTTP_200_OK)
class PopulatedTicketSerializer(TicketSerializer): creator = NestedUserSerializer() holders = NestedUserSerializer(many=True) comments = PopulatedCommentSerializer(many=True) tasks = TaskSerializer(many=True)