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.
jumpserver/apps/tickets/serializers/super_ticket.py

22 lines
547 B

from rest_framework import serializers
from django.utils.translation import gettext_lazy as _
from ..models import SuperTicket
__all__ = ['SuperTicketSerializer']
class SuperTicketSerializer(serializers.ModelSerializer):
processor = serializers.SerializerMethodField(label=_("Processor"))
class Meta:
model = SuperTicket
fields = ['id', 'status', 'state', 'processor']
@staticmethod
def get_processor(instance):
if not instance.processor:
return ''
return str(instance.processor)