# Create your views here.
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from feed.models import JsonFeeds
from rest_api.serializer import FeedSerializer
from datetime import datetime    
from rest_framework import permissions


@api_view(['GET', 'POST'])
def feed_list(request):
    #List all snippets, or create a new snippet.
    if request.method == 'GET':
        feeds = JsonFeeds.objects.all()[:25]
        serializer = FeedSerializer(feeds, many=True)
        return Response(serializer.data)

    elif request.method == 'POST':
        serializer = FeedSerializer(data=request.DATA)
        if serializer.is_valid():
            serializer.save()
            return Response(serializer.data, status=status.HTTP_201_CREATED)
        return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)




2a53702620c887bbeaa459346af6fcd42dbd48ac
<mask token>

<mask token>


@api_view(['GET', 'POST'])
def feed_list(request):
    if request.method == 'GET':
        feeds = JsonFeeds.objects.all()[:25]
        serializer = FeedSerializer(feeds, many=True)
        return Response(serializer.data)
    elif request.method == 'POST':
        serializer = FeedSerializer(data=request.DATA)
        if serializer.is_valid():
            serializer.save()
            return Response(serializer.data, status=status.HTTP_201_CREATED)
        return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)

from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from feed.models import JsonFeeds
from rest_api.serializer import FeedSerializer
from datetime import datetime
from rest_framework import permissions


@api_view(['GET', 'POST'])
def feed_list(request):
    if request.method == 'GET':
        feeds = JsonFeeds.objects.all()[:25]
        serializer = FeedSerializer(feeds, many=True)
        return Response(serializer.data)
    elif request.method == 'POST':
        serializer = FeedSerializer(data=request.DATA)
        if serializer.is_valid():
            serializer.save()
            return Response(serializer.data, status=status.HTTP_201_CREATED)
        return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)

# Create your views here.
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from feed.models import JsonFeeds
from rest_api.serializer import FeedSerializer
from datetime import datetime    
from rest_framework import permissions


@api_view(['GET', 'POST'])
def feed_list(request):
    #List all snippets, or create a new snippet.
    if request.method == 'GET':
        feeds = JsonFeeds.objects.all()[:25]
        serializer = FeedSerializer(feeds, many=True)
        return Response(serializer.data)

    elif request.method == 'POST':
        serializer = FeedSerializer(data=request.DATA)
        if serializer.is_valid():
            serializer.save()
            return Response(serializer.data, status=status.HTTP_201_CREATED)
        return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)



