Skip to content

Commit

Permalink
Solution
Browse files Browse the repository at this point in the history
  • Loading branch information
DOLC3-GABBANA committed Sep 20, 2024
1 parent 71d51d7 commit 02519db
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
5 changes: 2 additions & 3 deletions taxi/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from argparse import Namespace
from django.urls import path, include
from django.urls import path
from django.contrib.auth import views as auth_views

from taxi.views import (
Expand All @@ -9,7 +9,6 @@
DriverListView,
DriverDetailView,
ManufacturerListView,
user_logout
)


Expand Down Expand Up @@ -51,7 +50,7 @@
),
path(
"logout/",
user_logout,
auth_views.LogoutView.as_view(),
name="logout"
),
]
Expand Down
12 changes: 1 addition & 11 deletions taxi/views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from django.shortcuts import render, redirect
from django.shortcuts import render
from django.views import generic
from django.contrib.auth.decorators import login_required
from django.contrib.auth import logout
from django.contrib.auth.mixins import LoginRequiredMixin

from taxi.models import Driver, Car, Manufacturer
Expand All @@ -17,8 +16,6 @@ def index(request):
num_visits = request.session.get("num_visits", 0)
request.session["num_visits"] = num_visits + 1

request.session.save()

context = {
"num_drivers": num_drivers,
"num_cars": num_cars,
Expand Down Expand Up @@ -54,10 +51,3 @@ class DriverListView(LoginRequiredMixin, generic.ListView):
class DriverDetailView(LoginRequiredMixin, generic.DetailView):
model = Driver
queryset = Driver.objects.prefetch_related("cars__manufacturer")


@login_required
def user_logout(request):
"""View function to log out the user."""
logout(request)
return redirect("taxi:index")

0 comments on commit 02519db

Please sign in to comment.