-
Notifications
You must be signed in to change notification settings - Fork 835
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nazar Serdyuk
committed
Oct 30, 2024
1 parent
15a2836
commit c60cc64
Showing
10 changed files
with
129 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,23 @@ | ||
from django.urls import path | ||
|
||
from .views import index | ||
from .views import (index, ManufacturerListView, | ||
CarListView, | ||
CarDetailView, | ||
DriverListView, | ||
DriverDetailView) | ||
|
||
urlpatterns = [ | ||
path("", index, name="index"), | ||
path("manufacturers/", ManufacturerListView.as_view(), | ||
name="manufacturer-list"), | ||
path("cars/", CarListView.as_view(), | ||
name="car-list"), | ||
path("cars/<int:pk>/", CarDetailView.as_view(), | ||
name="car-detail"), | ||
path("drivers/", DriverListView.as_view(), | ||
name="driver-list"), | ||
path("drivers/<int:pk>/", DriverDetailView.as_view(), | ||
name="driver-detail"), | ||
] | ||
|
||
app_name = "taxi" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{% if is_paginated %} | ||
<ul class="pagination"> | ||
{% if page_obj.has_previous %} | ||
<li class="page-item"><a class="page-link" href="?page={{ page_obj.previous_page_number }}">Prev</a></li> | ||
{% endif %} | ||
<li class="page-item active"><span class="page-link">{{ page_obj.number }} of {{ paginator.num_pages }}</span></li> | ||
{% if page_obj.has_next %} | ||
<li class="page-item"><a class="page-link" href="?page={{ page_obj.next_page_number }}">Next</a></li> | ||
{% endif %} | ||
</ul> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<ul class="sidebar-nav"> | ||
<li><a href="#">Home page</a></li> | ||
<li><a href="#">Manufacturers</a></li> | ||
<li><a href="#">Cars</a></li> | ||
<li><a href="#">Drivers</a></li> | ||
<li><a href="{% url 'taxi:index' %}">Home page</a></li> | ||
<li><a href="{% url 'taxi:manufacturer-list' %}">Manufacturers</a></li> | ||
<li><a href="{% url 'taxi:car-list' %}">Cars</a></li> | ||
<li><a href="{% url 'taxi:driver-list' %}">Drivers</a></li> | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block content %} | ||
<h1>Car Details</h1> | ||
<h3>{{ car.model }}</h3> | ||
<p>Manufacturer: {{ car.manufacturer.name }}</p> | ||
<p>Country: {{ car.manufacturer.country }}</p> | ||
{% if car.drivers.all %} | ||
<p>Drivers:</p> | ||
<ul> | ||
{% for driver in car.drivers.all %} | ||
<li><a href="{% url 'taxi:driver-detail' driver.id %}">{{ driver.username }}</a></li> | ||
{% endfor %} | ||
</ul> | ||
{% else %} | ||
<h2>No drivers</h2> | ||
{% endif %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block content %} | ||
<h1>Car List</h1> | ||
{% if car_list %} | ||
<ul> | ||
{% for car in car_list %} | ||
<li><a href="{% url 'taxi:car-detail' car.id %}">{{ car.model }}</a></li> | ||
{% endfor %} | ||
</ul> | ||
{% endif %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block content %} | ||
{% if driver.cars.all %} | ||
<h3>Cars:</h3> | ||
<ul> | ||
{% for car in driver.cars.all %} | ||
<li><a href="{% url 'taxi:car-detail' car.id %}">{{ car.model }}</a></li> | ||
{% endfor %} | ||
</ul> | ||
{% else %} | ||
<h2>No cars</h2> | ||
{% endif %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block content %} | ||
<h1>Driver List</h1> | ||
{% if driver_list %} | ||
<ul> | ||
{% for driver in driver_list %} | ||
<li><a href="{% url 'taxi:driver-detail' driver.id %}">{{ driver.username }}</a></li> | ||
{% endfor %} | ||
</ul> | ||
{% endif %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block content %} | ||
<h1>Manufacturer List</h1> | ||
{% if manufacturer_list %} | ||
<ul> | ||
{% for manufacturer in manufacturer_list %} | ||
<li>{{ manufacturer.name }}</li> | ||
{% endfor %} | ||
</ul> | ||
{% endif %} | ||
{% endblock %} |