# coding=utf-8

import django_filters

from apps.WechatApplet.models import WechatApplet, MessageTemplate


class WechatAppletFilter(django_filters.FilterSet):
    user_version = django_filters.CharFilter(field_name='user_version', lookup_expr='icontains')
    wait_audit_version = django_filters.CharFilter(field_name='wait_audit_version', lookup_expr='icontains')
    wait_audit_template = django_filters.CharFilter(field_name='wait_audit_template', lookup_expr='icontains')
    audit_status = django_filters.CharFilter(field_name='audit_status')
    is_admin = django_filters.CharFilter(field_name='is_admin')

    class Meta:
        model = WechatApplet
        fields = '__all__'

class MsgTemplateFilter(django_filters.FilterSet):
    agent_name = django_filters.CharFilter(field_name='wechat_app__agent__name', lookup_expr='icontains')
    appid = django_filters.CharFilter(field_name='wechat_app__authorizer_appid')
    type = django_filters.CharFilter(field_name='type')

    class Meta:
        model = MessageTemplate
        fields = '__all__'
