from django_filters import rest_framework as filters
from apps.mtm.models import TechDoc




class TechDocFilterset(filters.FilterSet):
    # operation = filters.NumberFilter(method='filter_operation')
    operation = filters.CharFilter(field_name="subproduction__subplan_subprod__ow_subplan__operation")
    class Meta:
        model = TechDoc
        fields = ['subproduction', 'operation']

    # def filter_operation(self, queryset, name, value):
    #     return queryset.filter(subproduction__subplan_subprod__ow_subplan__operation=value)
