short view
This commit is contained in:
parent
233b65ae7e
commit
93575eb6c8
2 changed files with 4 additions and 1 deletions
|
@ -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"]
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue