api.py
376 Bytes
from rest_framework import viewsets
from rest_framework.permissions import IsAuthenticated
from .models import Evento
from .serializers import EventoSerializer
class EventoViewSets(viewsets.ReadOnlyModelViewSet):
queryset = Evento.objects.all().order_by('id')
serializer_class = EventoSerializer
permission_classes = [IsAuthenticated,]
lookup_field = 'id'