def televisionview(request, id): if not Television.objects.filter(id=id): return redirect('/') ourtelevision = Television.objects.get(id=id) ourtelevision = make_rating(ourtelevision) reviews = None if televisionreview.objects.filter(televisionid=id): reviews = televisionreview.objects.all() user = request.COOKIES.get('username') if UsersModal.objects.filter(username=user): user = UsersModal.objects.get(username=user) params = {"ourtelevision": ourtelevision, "user": user, "reviews": reviews} return render(request, 'GRSapp/endViews/television.html', params)
def kettleview(request, id): if not Kettle.objects.filter(id=id): return redirect('/') ourkettle = Kettle.objects.get(id=id) ourkettle = make_rating(ourkettle) reviews = None if kettlereview.objects.filter(kettleid=id): reviews = kettlereview.objects.all() user = request.COOKIES.get('username') if UsersModal.objects.filter(username=user): user = UsersModal.objects.get(username=user) params = {"ourkettle": ourkettle, "user": user, "reviews": reviews} return render(request, 'GRSapp/endViews/kettle.html', params)
def fridgeview(request, id): if not Refrigerator.objects.filter(id=id): return redirect('/') ourfridge = Refrigerator.objects.get(id=id) ourfridge = make_rating(ourfridge) reviews = None if fridgereview.objects.filter(fridgeid=id): reviews = fridgereview.objects.all() user = request.COOKIES.get('username') if UsersModal.objects.filter(username=user): user = UsersModal.objects.get(username=user) params = {"ourfridge": ourfridge, "user": user, "reviews": reviews} return render(request, 'GRSapp/endViews/fridge.html', params)
def cameraview(request, id): if not Camera.objects.filter(id=id): return redirect('/') ourcamera = Camera.objects.get(id=id) ourcamera = make_rating(ourcamera) reviews = None if camerareview.objects.filter(cameraid=id): reviews = camerareview.objects.all() user = request.COOKIES.get('username') if UsersModal.objects.filter(username=user): user = UsersModal.objects.get(username=user) params = {"ourcamera": ourcamera, "user": user, "reviews": reviews} return render(request, 'GRSapp/endViews/camera.html', params)
def powerbankview(request, id): if not Powerbank.objects.filter(id=id): return redirect('/') ourpowerbank = Powerbank.objects.get(id=id) ourpowerbank = make_rating(ourpowerbank) reviews = None if powerbankreview.objects.filter(powerbankid=id): reviews = powerbankreview.objects.all() user = request.COOKIES.get('username') if UsersModal.objects.filter(username=user): user = UsersModal.objects.get(username=user) params = {"ourpowerbank": ourpowerbank, "user": user, "reviews": reviews} return render(request, 'GRSapp/endViews/powerbank.html', params)
def headsetview(request, id): if not HeadSet.objects.filter(id=id): return redirect('/') ourheadset = HeadSet.objects.get(id=id) ourheadset = make_rating(ourheadset) reviews = None if headsetreview.objects.filter(headsetid=id): reviews = headsetreview.objects.all() user = request.COOKIES.get('username') if UsersModal.objects.filter(username=user): user = UsersModal.objects.get(username=user) params = {"ourheadset": ourheadset, "user": user, "reviews": reviews} return render(request, 'GRSapp/endViews/headset.html', params)
def laptopview(request, id): if not Laptops.objects.filter(id=id): return redirect('/') ourlaptop = Laptops.objects.get(id=id) ourlaptop = make_rating(ourlaptop) reviews = None if laptopreview.objects.filter(laptopid=id): reviews = laptopreview.objects.all() user = request.COOKIES.get('username') if UsersModal.objects.filter(username=user): user = UsersModal.objects.get(username=user) params = {"ourlaptop": ourlaptop, "user": user, "reviews": reviews} return render(request, 'GRSapp/endViews/laptop.html', params)
def washmachineview(request, id): if not WashingMachine.objects.filter(id=id): return redirect('/') ourwashmachine = WashingMachine.objects.get(id=id) ourwashmachine = make_rating(ourwashmachine) reviews = None if washmanchinereview.objects.filter(washmachineid=id): reviews = washmanchinereview.objects.all() user = request.COOKIES.get('username') if UsersModal.objects.filter(username=user): user = UsersModal.objects.get(username=user) params = { "ourwashmachine": ourwashmachine, "user": user, "reviews": reviews } return render(request, 'GRSapp/endViews/washmachine.html', params)