Add filtering to component API
This commit is contained in:
parent
3b1eb6118f
commit
c6fae17154
@ -53,12 +53,14 @@ class PartsComponentViewSet(viewsets.ModelViewSet):
|
|||||||
filter_backends = [filters.SearchFilter]
|
filter_backends = [filters.SearchFilter]
|
||||||
search_fields = ['id', 'name', 'package__name', 'manufacturer__name']
|
search_fields = ['id', 'name', 'package__name', 'manufacturer__name']
|
||||||
|
|
||||||
|
|
||||||
class PartsComponentTypeViewSet(viewsets.ModelViewSet):
|
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