diff --git a/suitablephones/serializers.py b/suitablephones/serializers.py index dbc2112..7a64475 100644 --- a/suitablephones/serializers.py +++ b/suitablephones/serializers.py @@ -31,4 +31,4 @@ class DeviceSerializer(serializers.ModelSerializer): class DeviceSerializerShort(DeviceSerializer): class Meta: model = Device - include = ["codename", "vendor", "name", "release", "maintainers", "cameras", "battery", "screen"] \ No newline at end of file + fields = ["codename", "vendor", "name", "versions", "maintainers", "cameras", "screen"] \ No newline at end of file diff --git a/suitablephones/views.py b/suitablephones/views.py index 65f0bfd..3533649 100644 --- a/suitablephones/views.py +++ b/suitablephones/views.py @@ -5,13 +5,13 @@ from rest_framework import viewsets from suitablephones.models import Bluetooth, Camera, Device from suitablephones.serializers import (BluetoothSerializer, CameraSerializer, - DeviceSerializer) + DeviceSerializer, DeviceSerializerShort) # ViewSets define the view behavior. class DeviceViewSet(viewsets.ModelViewSet): queryset = Device.objects.all() - serializer_class = DeviceSerializer + serializer_class = DeviceSerializerShort #http://url/api/devices?megapixel=3 def get_queryset(self): @@ -29,7 +29,7 @@ class DeviceViewSet(viewsets.ModelViewSet): if version: self.queryset = self.queryset.filter(versions__icontains=version) if size_in: - self.queryset = self.queryset.filter(screen__size_in__gt=Decimal(size_in)) + self.queryset = self.queryset.filter(screen__size_in__lt=Decimal(size_in)) if resolution: self.queryset = self.queryset.filter(screen__resolution__icontains=resolution) if screen_type: