Aggiorna 'suitablephones/views.py'

This commit is contained in:
parruc 2023-01-03 11:08:27 +01:00
parent f590a365c3
commit 2ff1d99876

View file

@ -1,5 +1,16 @@
from django.shortcuts import render
from django.http import HttpResponse
from django.views.generic.list import ListView
from suitablephones.models import Device, Camera
def suitablephones(request):
return HttpResponse("These are suitable phones")
class SuitablePhones(ListView):
model = Device
def get_request_camera(self):
return self.request.GET.get("camera")
def get_queryset(self):
camera = self.get_request_camera()
return self.model.objects.filter(camera=camera)