search soc
This commit is contained in:
parent
a002819abb
commit
39144a209e
2 changed files with 6 additions and 3 deletions
|
@ -34,7 +34,7 @@ class Screen(models.Model):
|
|||
return f"{str(self.size_in)} - {str(self.density)} - {str(self.technology)}"
|
||||
|
||||
class Device(models.Model):
|
||||
architecture = models.JSONField(default=dict)
|
||||
#architecture = models.JSONField(default=dict)
|
||||
#battery = models.JSONField(default=dict)
|
||||
#before_install = models.JSONField(default=dict, null=True) # dict or str
|
||||
bluetooth = models.ForeignKey(Bluetooth, on_delete=models.CASCADE, null=True)
|
||||
|
|
|
@ -39,20 +39,23 @@ class DeviceViewSet(viewsets.ModelViewSet):
|
|||
size_in = self.request.query_params.get('size_in')
|
||||
resolution = self.request.query_params.get('resolution')
|
||||
screen_type = self.request.query_params.get('screen_type')
|
||||
soc = self.request.query_params.get('soc')
|
||||
#maintainers = self.request.query_params.getlist('maintainers')
|
||||
version = self.request.query_params.get('version')
|
||||
if name:
|
||||
self.queryset = self.queryset.filter(name__icontains=name)
|
||||
if megapixel:
|
||||
self.queryset = self.queryset.filter(cameras__megapixel__gt=Decimal(megapixel))
|
||||
if version:
|
||||
self.queryset = self.queryset.filter(versions__icontains=version)
|
||||
if 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:
|
||||
self.queryset = self.queryset.filter(screen__technology__icontains=screen_type)
|
||||
if soc:
|
||||
self.queryset = self.queryset.filter(soc__icontains=soc)
|
||||
if version:
|
||||
self.queryset = self.queryset.filter(versions__icontains=version)
|
||||
#if maintainers:
|
||||
self.queryset = self.queryset.filter(maintainers__len__gt=0)
|
||||
return self.queryset
|
||||
|
|
Loading…
Reference in a new issue