vendor and release

This commit is contained in:
d0c 2023-06-13 16:30:18 +02:00
parent eddebd3192
commit 0b8d97c582
2 changed files with 8 additions and 2 deletions

View file

@ -61,7 +61,7 @@ class Device(models.Model):
ram = models.CharField(max_length=100)
recovery_boot = models.CharField(max_length=1000)
recovery_reboot = models.CharField(max_length=100)
#release = models.DateField()
release = models.CharField(max_length=100, null=True)
screen = models.ManyToManyField(Screen)
#sdcard = models.JSONField(default=dict) # dict or str{1}
soc = models.CharField(max_length=1000)

View file

@ -36,11 +36,13 @@ class DeviceViewSet(viewsets.ModelViewSet):
def get_queryset(self):
name = self.request.query_params.get('name')
megapixel = self.request.query_params.get('megapixel')
size_in = self.request.query_params.get('size_in')
release = self.request.query_params.get('release')
resolution = self.request.query_params.get('resolution')
screen_type = self.request.query_params.get('screen_type')
size_in = self.request.query_params.get('size_in')
soc = self.request.query_params.get('soc')
storage = self.request.query_params.get('storage')
vendor = self.request.query_params.get('vendor')
version = self.request.query_params.get('version')
#maintainers = self.request.query_params.getlist('maintainers')
short_view = self.request.query_params.get('short_view')
@ -50,6 +52,8 @@ class DeviceViewSet(viewsets.ModelViewSet):
self.queryset = self.queryset.filter(cameras__megapixel__gt=Decimal(megapixel))
if size_in:
self.queryset = self.queryset.filter(screen__size_in__lt=Decimal(size_in))
if release:
self.queryset = self.queryset.filter(release__icontains=release)
if resolution:
self.queryset = self.queryset.filter(screen__resolution__icontains=resolution)
if screen_type:
@ -58,6 +62,8 @@ class DeviceViewSet(viewsets.ModelViewSet):
self.queryset = self.queryset.filter(soc__icontains=soc)
if storage:
self.queryset = self.queryset.filter(storage__icontains=storage)
if vendor:
self.queryset = self.queryset.filter(vendor__icontains=vendor)
if version:
self.queryset = self.queryset.filter(versions__icontains=version)