# coding=utf-8

from rest_framework import serializers
from apps.WechatApplet.models import WechatApplet


class WechatAppletSerializer(serializers.ModelSerializer):
    audit_status_text = serializers.CharField(source='get_audit_status_display', read_only=True)
    tenant_name = serializers.CharField(source='tenant.name', read_only=True)
    authorize_text = serializers.SerializerMethodField()

    def get_authorize_text(self, obj):
        if obj.is_authorize:
            return u'是'
        return u'否'

    class Meta:
        model = WechatApplet
        fields = '__all__'
