from django_filters import rest_framework as filters
from .models import Record


class RecordFilter(filters.FilterSet):
    date_lt = filters.DateFilter(field_name='up_date',lookup_expr="lt")
    date_gt = filters.DateFilter(field_name='up_date',lookup_expr="gt")
    belong_dept=filters.NumberFilter(field_name='belong_dept')
    content_name = filters.CharFilter(field_name='content__name')
    state = filters.CharFilter(field_name='state',lookup_expr='icontains')
    isself = filters.BooleanFilter(field_name='is_self', lookup_expr='isnull')
    class Meta:
        model = Record
        fields = ['up_date','content__name','belong_dept','state','is_self','task', 'content']
