jumpserver/apps/ops/serializers/adhoc.py

20 lines
706 B
Python
Raw Normal View History

# ~*~ coding: utf-8 ~*~
from __future__ import unicode_literals
2022-11-11 11:20:17 +00:00
from rest_framework import serializers
2022-11-11 11:20:17 +00:00
from common.drf.fields import ReadableHiddenField
2022-12-15 09:25:21 +00:00
from orgs.mixins.serializers import BulkOrgResourceModelSerializer
from ..models import AdHoc
2022-12-15 09:25:21 +00:00
class AdHocSerializer(BulkOrgResourceModelSerializer):
creator = ReadableHiddenField(default=serializers.CurrentUserDefault())
2022-11-11 11:20:17 +00:00
row_count = serializers.IntegerField(read_only=True)
size = serializers.IntegerField(read_only=True)
class Meta:
model = AdHoc
read_only_field = ["id", "row_count", "size", "creator", "date_created", "date_updated"]
fields = read_only_field + ["id", "name", "module", "args", "comment"]