from django.shortcuts import render
from rest_framework import viewsets
from .models import Product
from .serializers import ProductSerializer
# Create your views here.

class ProductViewSet(viewsets.ModelViewSet):
    #queryset = Product.objects.get(price=500)
    queryset = Product.objects.all()#GET ALL THE CATEGORIES
    serializer_class = ProductSerializer #This will be serialising the data.

    def filter_bycateg(self,request,id):
      return Product.objects.filter(category__id=1)
      #return 1
4ccc82d6092c1c660b0e6e8a488554f0d69c47b2
<mask token>


class ProductViewSet(viewsets.ModelViewSet):
    <mask token>
    <mask token>
    <mask token>

<mask token>


class ProductViewSet(viewsets.ModelViewSet):
    <mask token>
    <mask token>

    def filter_bycateg(self, request, id):
        return Product.objects.filter(category__id=1)

<mask token>


class ProductViewSet(viewsets.ModelViewSet):
    queryset = Product.objects.all()
    serializer_class = ProductSerializer

    def filter_bycateg(self, request, id):
        return Product.objects.filter(category__id=1)

from django.shortcuts import render
from rest_framework import viewsets
from .models import Product
from .serializers import ProductSerializer


class ProductViewSet(viewsets.ModelViewSet):
    queryset = Product.objects.all()
    serializer_class = ProductSerializer

    def filter_bycateg(self, request, id):
        return Product.objects.filter(category__id=1)

from django.shortcuts import render
from rest_framework import viewsets
from .models import Product
from .serializers import ProductSerializer
# Create your views here.

class ProductViewSet(viewsets.ModelViewSet):
    #queryset = Product.objects.get(price=500)
    queryset = Product.objects.all()#GET ALL THE CATEGORIES
    serializer_class = ProductSerializer #This will be serialising the data.

    def filter_bycateg(self,request,id):
      return Product.objects.filter(category__id=1)
      #return 1