from rest_framework import viewsets
from .. import models, serializers
import logging

class RolLineaViewSet(viewsets.ModelViewSet):
    serializer_class = serializers.RolLineaSerializer
    
    def get_queryset(self):
        id_rol = self.request.query_params.get('id_rol')  # Obtener el valor del parámetro id_rol desde la solicitud
        
        if id_rol is not None:
            return models.RolLinea.objects.filter(id_rol=id_rol)
        
        return models.RolLinea.objects.all()