from django_filters import rest_framework as filters

from assets.models.assets import Asset


class AssetFilter(filters.FilterSet):
    incidents = filters.UUIDFilter(method='filter_by_incidents')

    def filter_by_incidents(self, queryset, name, value):
        return queryset.filter(incidents=value)

    class Meta:
        model = Asset
        fields = ['incidents']
