jumpserver/apps/ops/api/adhoc.py

23 lines
418 B
Python
Raw Normal View History

# -*- coding: utf-8 -*-
#
2022-11-11 11:20:17 +00:00
from rest_framework import viewsets
from ..models import AdHoc
from ..serializers import (
2022-11-11 11:20:17 +00:00
AdHocSerializer, AdhocListSerializer,
)
__all__ = [
2022-11-11 11:20:17 +00:00
'AdHocViewSet'
]
2017-12-10 16:29:25 +00:00
class AdHocViewSet(viewsets.ModelViewSet):
2018-07-14 16:55:05 +00:00
queryset = AdHoc.objects.all()
2017-12-10 16:29:25 +00:00
def get_serializer_class(self):
2022-11-11 11:20:17 +00:00
if self.action != 'list':
return AdhocListSerializer
return AdHocSerializer
2018-04-02 07:54:49 +00:00