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
541 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(ticket):
if not ticket.processor:
return ''
return str(ticket.processor)