from rest_framework.decorators import action
from rest_framework.filters import SearchFilter
from rest_framework.viewsets import ModelViewSet
from ligas.models import Liga
from .serializers import LigaSerializer
from django.contrib.auth import get_user_model
from rest_framework.permissions import IsAuthenticated


User = get_user_model()

class LigaViewSet(ModelViewSet):
    #permission_classes = (IsAuthenticated,)
    queryset = Liga.objects.all()
    serializer_class = LigaSerializer
    filter_backends = (SearchFilter,)
    search_fields = ('nome',)


