# coding=utf-8

from rest_framework import generics

from utils.permission import IsAdministratorUser

from apps.vehicle.filters import VehicleFilter
from .serializers import *


class VehicleListViewSet(generics.ListAPIView):
    permission_classes = [IsAdministratorUser, ]
    queryset = Vehicle.objects.filter()
    serializer_class = VehicleSerializer

    def filter_queryset(self, queryset):
        queryset = queryset.filter()
        f = VehicleFilter(self.request.GET, queryset=queryset)
        return f.qs
