import json

from django.views.generic import View
from django.http.response import HttpResponse

from posts.models import Post


class PostListAPIView(View):

    def get(self, request, *args, **kwargs):

        data = [
            {
                "title": post.title,
                "content": post.content,
                "youtube_original_url": post.youtube_original_url,
            }
            for post
            in Post.objects.all()
        ]

        return HttpResponse(
            json.dumps(data),
            content_type="application/json",
        )

@@ -15,36 +15,36 @@
 rom 
-django.views.generic
+rest_framework.views
  import 
 View
@@ -39,16 +39,19 @@
  import 
+API
 View%0Afro
@@ -56,19 +56,22 @@
 rom 
-django.http
+rest_framework
 .res
@@ -83,20 +83,16 @@
  import 
-Http
 Response
@@ -125,16 +125,16 @@
  Post%0A%0A%0A
-
 class Po
@@ -147,16 +147,19 @@
 APIView(
+API
 View):%0A%0A
@@ -479,12 +479,8 @@
 urn 
-Http
 Resp
@@ -488,90 +488,10 @@
 nse(
-%0A            json.dumps(data),%0A            content_type=%22application/json%22,%0A        
+data
 )%0A

update PostListAPIView: inherit from APIView