import django_filters
from .models import Job


class JobFilter(django_filters.FilterSet):
    title = django_filters.CharFilter(lookup_expr='icontains')
    category = django_filters.CharFilter(lookup_expr='exact')
    location = django_filters.CharFilter(lookup_expr='icontains')
    organization = django_filters.NumberFilter(field_name='organization__id')
    education = django_filters.BaseInFilter(field_name='education', lookup_expr='in')

    class Meta:
        model = Job
        fields = ['title', 'category', 'location', 'organization', 'education']
