short view

This commit is contained in:
d0c 2023-06-02 21:59:38 +02:00
parent 233b65ae7e
commit 93575eb6c8
2 changed files with 4 additions and 1 deletions

View file

@ -31,4 +31,4 @@ class DeviceSerializer(serializers.ModelSerializer):
class DeviceSerializerShort(DeviceSerializer):
class Meta:
model = Device
fields = ["codename", "vendor", "name", "versions", "maintainers", "cameras", "screen"]
fields = ["codename", "vendor", "name", "cameras", "screen"]

View file

@ -40,6 +40,7 @@ class DeviceViewSet(viewsets.ModelViewSet):
resolution = self.request.query_params.get('resolution')
screen_type = self.request.query_params.get('screen_type')
soc = self.request.query_params.get('soc')
short_view = self.request.query_params.get('short_view')
#maintainers = self.request.query_params.getlist('maintainers')
version = self.request.query_params.get('version')
if name:
@ -57,6 +58,8 @@ class DeviceViewSet(viewsets.ModelViewSet):
if version:
self.queryset = self.queryset.filter(versions__icontains=version)
#if maintainers:
if short_view:
self.serializer_class = DeviceSerializerShort
self.queryset = self.queryset.filter(maintainers__len__gt=0)
return self.queryset