From 7a201f3614366e697a4fecc2c2100cb97aed34f4 Mon Sep 17 00:00:00 2001 From: Alex Bul Date: Sun, 3 Nov 2024 11:03:38 +0200 Subject: [PATCH] 'Solution' --- taxi/views.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/taxi/views.py b/taxi/views.py index 68ffc1ba..41d9749e 100644 --- a/taxi/views.py +++ b/taxi/views.py @@ -6,21 +6,21 @@ from .models import Driver, Car, Manufacturer - +@login_required() def index(request): """View function for the home page of the site.""" num_drivers = Driver.objects.count() num_cars = Car.objects.count() num_manufacturers = Manufacturer.objects.count() - num_visit = request.session.get('num_visit', 0) - request.session['num_visit'] = num_visit + 1 + num_visit = request.session.get("num_visit", 0) + request.session["num_visit"] = num_visit + 1 context = { "num_drivers": num_drivers, "num_cars": num_cars, "num_manufacturers": num_manufacturers, - "num_visit": request.session['num_visit'], + "num_visit": request.session["num_visit"], } return render(request, "taxi/index.html", context=context)