# Path: tests/patterns_app/models.py
# class FilterableModel(patterns.LabelModel):
#     name = models.CharField(max_length=10)
#     parent = models.ForeignKey(
#         IdentifiedModel, models.CASCADE
#     )


from rest_framework.generics import ListAPIView
from wq.db.patterns.identify.filters import IdentifierFilterBackend
from .models import FilterableModel
from wq.db.rest.serializers import ModelSerializer


class FilterableView(ListAPIView):
    serializer_class = ModelSerializer.for_model(
        FilterableModel,
        include_fields='__all__',
    )
    filter_backends = [IdentifierFilterBackend]

# Path: tests/patterns_app/models.py
# class FilterableModel(patterns.LabelModel):
#     name = models.CharField(max_length=10)
#     parent = models.ForeignKey(
#         IdentifiedModel, models.CASCADE
#     )


# Path: tests/patterns_app/views.py
from rest_framework.generics import ListAPIView
from wq.db.patterns.identify.filters import IdentifierFilterBackend
from .models import FilterableModel
from wq.db.rest.serializers import ModelSerializer



class FilterableView(ListAPIView):
    serializer_class = ModelSerializer.for_model(
        FilterableModel,
        include_fields='__all__',
    )
    filter_backends = [IdentifierFilterBackend]

    queryset = FilterableModel.objects.all()