diff --git a/storage/apiviews.py b/storage/apiviews.py index 36bd6ce..fbc2f3b 100644 --- a/storage/apiviews.py +++ b/storage/apiviews.py @@ -30,7 +30,7 @@ class LabelViewSet(viewsets.ModelViewSet): API endpoint that allows items to be viewed or edited. """ - queryset = Label.objects + queryset = Label.objects.all() serializer_class = LabelSerializer @action(detail=True, methods=["post"], permission_classes=[AllowAny]) @@ -47,13 +47,13 @@ class ItemViewSet(viewsets.ModelViewSet): API endpoint that allows items to be viewed or edited. """ - queryset = Item.objects + queryset = Item.objects.all() serializer_class = ItemSerializer filter_backends = (SmartSearchFilterBackend, filters.OrderingFilter) ordering_fields = "__all__" def get_queryset(self): - return Item.objects.filter_roots() + return Item.objects.filter(**{"path__level": 1}) def get_object(self): lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_field diff --git a/storage/serializers.py b/storage/serializers.py index dbe96c2..cef102e 100644 --- a/storage/serializers.py +++ b/storage/serializers.py @@ -3,7 +3,7 @@ from storage.models import Item, Label, Category from rest_framework import serializers -class ItemSerializer(serializers.HStoreField): +class ItemSerializer(serializers.ModelSerializer): categories = serializers.SlugRelatedField( queryset=Category.objects, many=True, slug_field="name" )