from rest_framework import generics,permissions
from .models import Country,Campus,Industry
from .serializers import CountrySerializer,CampusSerializer,IndustrySerializer
class CountryList(generics.ListAPIView):
 permission_classes=[permissions.AllowAny]; queryset=Country.objects.all(); serializer_class=CountrySerializer
class CampusList(generics.ListAPIView):
 permission_classes=[permissions.AllowAny]; serializer_class=CampusSerializer; filterset_fields=['country','active']; search_fields=['name','institution','city']
 def get_queryset(self): return Campus.objects.select_related('country').filter(active=True)
class IndustryList(generics.ListAPIView):
 permission_classes=[permissions.IsAuthenticated]; serializer_class=IndustrySerializer; pagination_class=None; search_fields=['name']
 def get_queryset(self): return Industry.objects.filter(active=True)
