# coding=utf-8

import django_filters
from .models import Area, Department


class AreaFilter(django_filters.FilterSet):
    name = django_filters.CharFilter(field_name='name', lookup_expr='icontains')
    tenant = django_filters.CharFilter(field_name='tenant_id')

    class Meta:
        model = Area
        fields = '__all__'

class AreaDepartmentFilter(django_filters.FilterSet):
    name = django_filters.CharFilter(field_name='name', lookup_expr='icontains')
    area_name = django_filters.CharFilter(field_name='area__name', lookup_expr='icontains')

    class Meta:
        model = Department
        fields = '__all__'
