<reponame>adamszustak/Personal-blog-django<gh_stars>1-10
from django.shortcuts import get_object_or_404

from rest_framework import mixins, views, viewsets

from ..models import Comment, ReplyComment
from .serializers import CommentSerializer, ReplyCommentSerializer


class CommentViewSet(
    mixins.CreateModelMixin,
    mixins.ListModelMixin,
    mixins.RetrieveModelMixin,
    viewsets.GenericViewSet,
):
    queryset = Comment.objects.filter(is_approved=True)
    serializer_class = CommentSerializer

from django.shortcuts import get_object_or_404

from rest_framework import mixins, views, viewsets

from ..models import Comment, ReplyComment
from .serializers import CommentSerializer, ReplyCommentSerializer


class CommentViewSet(
    mixins.CreateModelMixin,
    mixins.ListModelMixin,
    mixins.RetrieveModelMixin,
    viewsets.GenericViewSet,
):
    queryset = Comment.objects.filter(is_approved=True)
    serializer_class = CommentSerializer