Add filtering to component API
This commit is contained in:
parent
a3fc0e8447
commit
76c79403f2
@ -57,8 +57,9 @@ class PartsComponentTypeViewSet(viewsets.ModelViewSet):
|
|||||||
queryset = parts_models.ComponentType.objects.all()
|
queryset = parts_models.ComponentType.objects.all()
|
||||||
serializer_class = ComponentTypeSerializer
|
serializer_class = ComponentTypeSerializer
|
||||||
permission_classes = [permissions.DjangoModelPermissions]
|
permission_classes = [permissions.DjangoModelPermissions]
|
||||||
filter_backends = [filters.SearchFilter]
|
filter_backends = [filters.SearchFilter, django_filters.rest_framework.DjangoFilterBackend]
|
||||||
search_fields = ['class_name']
|
search_fields = ['class_name']
|
||||||
|
filterset_fields = ['id', 'name']
|
||||||
|
|
||||||
class PartsComponentParameterTypeViewSet(viewsets.ModelViewSet):
|
class PartsComponentParameterTypeViewSet(viewsets.ModelViewSet):
|
||||||
queryset = parts_models.ComponentParameterType.objects.all()
|
queryset = parts_models.ComponentParameterType.objects.all()
|
||||||
|
Loading…
Reference in New Issue
Block a user