17 lines
496 B
Python
17 lines
496 B
Python
from django.shortcuts import render
|
|
|
|
# Create your views here.
|
|
from rest_framework import viewsets
|
|
from rest_framework.permissions import IsAuthenticatedOrReadOnly
|
|
|
|
from products.models import Product
|
|
from products.serializers import ProductSerializer
|
|
|
|
from back_latienda.permissions import IsCreator
|
|
|
|
|
|
class ProductViewSet(viewsets.ModelViewSet):
|
|
queryset = Product.objects.all()
|
|
serializer_class = ProductSerializer
|
|
permission_classes = [IsAuthenticatedOrReadOnly, IsCreator]
|