# coding=utf-8
import django_filters

from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group

User = get_user_model()


class UserFilter(django_filters.FilterSet):
    name = django_filters.CharFilter(field_name='name', lookup_expr='icontains')
    tel = django_filters.CharFilter(field_name='tel', lookup_expr='icontains')
    username = django_filters.CharFilter(field_name='username', lookup_expr='icontains')
    is_active = django_filters.CharFilter(field_name='is_active')

    class Meta:
        model = User
        fields = ['name', 'username', 'tel', 'is_active']

class GroupFilter(django_filters.FilterSet):

    class Meta:
        model = Group
        fields = '__all__'
