# from django.http import HttpResponse
# from django.views.decorators.csrf import csrf_exempt
# from rest_framework.renderers import JSONRenderer
# from rest_framework.parsers import JSONParser
# from skynet.models import Messages
# from skynet.serializers import SkynetSerializer
# from django.db.models import Count

from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from skynet.models import Messages
from skynet.serializers import SkynetSerializer
from rest_framework.views import APIView


# @api_view(['GET'])
# def skynet_list(request, format=None):
#     """
#     List all snippets, or create a new snippet.
#     """
#     if request.method == 'GET':
#         messages = Messages.objects.all()
#         serializer = SkynetSerializer(messages, many=True)
#         return Response(serializer.data)

class SkynetList(APIView):
    """
    List all messages, or create a new message.
    """
    def get(self, request, format=None):
        snippets = Messages.objects.all()
        serializer = SkynetSerializer(snippets, many=True)
        return Response(serializer.data)
@@ -1,200 +1,4 @@
-# from django.http import HttpResponse%0A# from django.views.decorators.csrf import csrf_exempt%0A# from rest_framework.renderers import JSONRenderer%0A# from rest_framework.parsers import JSONParser%0A# 
 from
@@ -28,18 +28,16 @@
 essages%0A
-# 
 from sky
@@ -80,761 +80,104 @@
 zer%0A
-# from django.db.models import Count%0A%0Afrom rest_framework import status%0Afrom rest_framework.decorators import api_view%0Afrom rest_framework.response import Response%0Afrom skynet.models import Messages%0Afrom skynet.serializers import SkynetSerializer%0Afrom rest_framework.views import APIView%0A%0A%0A# @api_view(%5B'GET'%5D)%0A# def skynet_list(request, format=None):%0A#     %22%22%22%0A#     List all snippets, or create a new snippet.%0A#     %22%22%22%0A#     if request.method == 'GET':%0A#         messages = Messages.objects.all()%0A#         serializer = SkynetSerializer(messages, many=True)%0A#         return Response(serializer.data)%0A%0Aclass SkynetList(APIView):%0A    %22%22%22%0A    List all messages, or create a new message.%0A    %22%22%22%0A    def get(self, request, format=None):%0A        snipp
+from rest_framework import generics%0A%0A%0Aclass SkynetList(generics.ListCreateAPIView):%0A    querys
 et
-s
  = M
@@ -198,20 +198,16 @@
 s.all()%0A
-    
     seri
@@ -212,16 +212,22 @@
 rializer
+_class
  = Skyne
@@ -241,66 +241,4 @@
 izer
-(snippets, many=True)%0A        return Response(serializer.data)

move to generic class based views