Skip to content

Commit

Permalink
'Solution'
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexTarasov57 committed Nov 3, 2024
1 parent 2edec06 commit 7a201f3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions taxi/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7a201f3

Please sign in to comment.