# coding=utf-8

from utils.permission import IsAdministrator
from rest_framework import generics
from apps.system.models import SysLog
from apps.system.filters import SysLogFilter
from apps.system.serializers import SysLogSerializer


class LogViewSet(generics.ListAPIView):
    permission_classes = [IsAdministrator, ]
    queryset = SysLog.objects.filter()
    serializer_class = SysLogSerializer

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

