update
Dariusz Niemczyk 2023-07-17 15:46:00 +02:00
rodzic d2e25c0801
commit f7688262e4
Nie znaleziono w bazie danych klucza dla tego podpisu
2 zmienionych plików z 4 dodań i 4 usunięć

Wyświetl plik

@ -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

Wyświetl plik

@ -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"
)