Aggiorna 'suitablephones/views.py'
This commit is contained in:
parent
f590a365c3
commit
2ff1d99876
1 changed files with 13 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue