# coding=utf-8

from rest_framework import serializers

from .models import SysLog


class SysLogSerializer(serializers.ModelSerializer):
    user_name = serializers.CharField(source='user.name', read_only=True)
    username = serializers.CharField(source='user.username', read_only=True)
    user_department = serializers.CharField(source='user.department.name', read_only=True)
    type_text = serializers.CharField(source='get_type_display', read_only=True)

    class Meta:
        model = SysLog
        fields = '__all__'
