from django.shortcuts import render
from rest_framework.viewsets import ModelViewSet
from .models import Expert
from .serializers import ExpertListSerializer
from apps.system.mixins import OptimizationMixin
# Create your views here.

class ExpertViewSet(OptimizationMixin, ModelViewSet):
    perms_map={'get':'expert_view'}
    queryset = Expert.objects.all()
    search_fields = ['name', 'workexperience_expert__name', 'project_expert__name', 'paper_expert__name', 'award_expert__name']
    filterset_fields = ['hdegree']
    serializer_class = ExpertListSerializer
    ordering = ['-create_time']