from django.shortcuts import render
from rest_framework.decorators import api_view
from rest_framework.response import Response
import json
from .serializers import portfolioSerializer
from .models import portfolio
# Create your views here.

@api_view(['GET'])
def portfolio_all(request):
        
        category_obj = portfolio.objects.all().filter()
        
        obj=portfolioSerializer(category_obj , many=True)


        return Response(obj.data)

@api_view(['GET'])
def web_all(request):
        category_obj = portfolio.objects.all().filter(kind__name="web")
        
        obj=portfolioSerializer(category_obj , many=True)


        return Response(obj.data)

@api_view(['GET'])
def iphone_all(request):
        category_obj = portfolio.objects.all().filter(kind__name="phone")
        
        obj=portfolioSerializer(category_obj , many=True)


        return Response(obj.data)
@api_view(['GET'])
def windows_all(request):
        category_obj = portfolio.objects.all().filter(kind__name="computer")
        
        obj=portfolioSerializer(category_obj , many=True)


        return Response(obj.data)


