mirror of https://github.com/jumpserver/jumpserver
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
746 B
20 lines
746 B
# ~*~ coding: utf-8 ~*~
|
|
from __future__ import unicode_literals
|
|
from django.utils.translation import gettext_lazy as _
|
|
from rest_framework import serializers
|
|
|
|
from common.serializers.fields import ReadableHiddenField, LabeledChoiceField
|
|
from common.serializers.mixin import CommonBulkModelSerializer
|
|
from .mixin import ScopeSerializerMixin
|
|
from ..const import Scope
|
|
from ..models import AdHoc
|
|
|
|
|
|
class AdHocSerializer(ScopeSerializerMixin, CommonBulkModelSerializer):
|
|
creator = ReadableHiddenField(default=serializers.CurrentUserDefault())
|
|
|
|
class Meta:
|
|
model = AdHoc
|
|
read_only_field = ["id", "creator", "date_created", "date_updated"]
|
|
fields = read_only_field + ["id", "name", "scope", "module", "args", "comment"]
|