Skip to content

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Quiet-Klirik committed Aug 18, 2023
1 parent ca2af7b commit 90678f7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion static/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ body {
.click:hover {
background-color: rgba(0, 0, 0, 0.05);
cursor: pointer;
}
}
10 changes: 5 additions & 5 deletions taxi/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@
urlpatterns = [
path("", index, name="index"),
path(
"manufacturers",
"manufacturers/",
ManufacturerListView.as_view(),
name="manufacturer-list"
),
path(
"cars",
"cars/",
CarListView.as_view(),
name="car-list"
),
path(
"cars/<int:pk>",
"cars/<int:pk>/",
CarDetailView.as_view(),
name="car-detail"
),
path(
"drivers",
"drivers/",
DriverListView.as_view(),
name="driver-list"
),
path(
"drivers/<int:pk>",
"drivers/<int:pk>/",
DriverDetailView.as_view(),
name="driver-detail"
),
Expand Down
10 changes: 5 additions & 5 deletions taxi/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def index(request):


class ManufacturerListView(generic.ListView):
# queryset = Manufacturer.objects.all().order_by("name")
# queryset = Manufacturer.objects.order_by("name")
model = Manufacturer
ordering = ["name"]
context_object_name = "manufacturer_list"
Expand All @@ -31,7 +31,7 @@ class ManufacturerListView(generic.ListView):

class CarListView(generic.ListView):
model = Car
queryset = Car.objects.all().select_related(
queryset = Car.objects.select_related(
"manufacturer"
).prefetch_related("drivers")
context_object_name = "car_list"
Expand All @@ -58,6 +58,6 @@ class DriverDetailView(generic.DetailView):
template_name = "taxi/driver_detail.html"

def get_queryset(self):
return self.model.objects.prefetch_related("cars").filter(
id=self.kwargs.get("pk")
)
return self.model.objects.prefetch_related(
"cars", "cars__manufacturer"
).filter(id=self.kwargs.get("pk"))

0 comments on commit 90678f7

Please sign in to comment.