# coding=utf-8
import django_filters

from .models import ReportCustomer,NewCustomer

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

    class Meta:
        model = ReportCustomer
        fields = '__all__'


class NewCustomerFilter(django_filters.FilterSet):
    name = django_filters.CharFilter(field_name='report_customer__name', lookup_expr='icontains')
    tel = django_filters.CharFilter(field_name='report_customer__tel', lookup_expr='icontains')

    class Meta:
        model = NewCustomer
        fields = '__all__'


class ReviewFilter(django_filters.FilterSet):
    name = django_filters.CharFilter(field_name='customer__name', lookup_expr='icontains')
    tel = django_filters.CharFilter(field_name='customer__tel', lookup_expr='icontains')

    class Meta:
        model = NewCustomer
        fields = '__all__'
