-
Notifications
You must be signed in to change notification settings - Fork 843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
solution #869
base: master
Are you sure you want to change the base?
solution #869
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{% extends "base.html" %} | ||
{% block content %} | ||
<h1>Delete Car </h1> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The heading 'Delete Car ' contains an extra space at the end. Consider removing the trailing space for consistency and to maintain a clean appearance. |
||
<form action="" method="post"> | ||
{% csrf_token %} | ||
<input type="submit" value="Yes, delete" class="btn btn-danger" /> | ||
<a class="btn btn-primary" href="{% url 'taxi:car-detail' pk=car.id %}" role="button">Cancel</a> | ||
</form> | ||
{% endblock %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,6 @@ <h1>Drivers</h1> | |
<li>{{ driver.username }} ({{ driver.first_name }} {{ driver.last_name }})</li> | ||
{% endfor %} | ||
</ul> | ||
<a class="btn btn-primary" href="{% url 'taxi:car-update' pk=car.id %}" role="button">Update</a> | ||
<a class="btn btn-danger" href="{% url 'taxi:car-delete' pk=car.id %}" role="button">Delete</a> | ||
Comment on lines
+12
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure there is consistent spacing around the attributes in the |
||
{% endblock %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{% extends "base.html" %} | ||
{% load crispy_forms_filters %} | ||
{% block content %} | ||
<h1>{{ object|yesno:"Update,Create" }} Car Form</h1> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The use of |
||
<form action="" method="post" novalidate> | ||
{% csrf_token %} | ||
{{ form | crispy }} | ||
<input class="btn btn-primary" type="submit" value="Submit"> | ||
</form> | ||
{% endblock %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,28 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block content %} | ||
<h1>Car list</h1> | ||
<h1>Car list <a class="btn btn-primary" style="float: right" href="{% url 'taxi:car-create' %}" role="button">Create</a></h1> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure there is consistent spacing around the attributes in the |
||
{% if car_list %} | ||
<ul> | ||
{% for car in car_list %} | ||
<li> | ||
<a href="{% url "taxi:car-detail" pk=car.id %} ">{{ car.id }}</a> | ||
{{ car.model }} ({{ car.manufacturer.name }}) | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
<table class="table"> | ||
<tr> | ||
<th>ID</th> | ||
<th>Model</th> | ||
<th>Manufacturer</th> | ||
</tr> | ||
{% for car in car_list %} | ||
<tr> | ||
<td> | ||
{{ car.id }} | ||
</td> | ||
<td> | ||
<a href="{% url 'taxi:car-detail' pk=car.id %}">{{ car.model }}</a> | ||
</td> | ||
<td> | ||
{{ car.manufacturer.name }} | ||
</td> | ||
</tr> | ||
{% endfor %} | ||
</table> | ||
{% else %} | ||
<p>There are no cars in taxi</p> | ||
{% endif %} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block content %} | ||
<h1>Delete Manufacturer</h1> | ||
<form action="" method="post"> | ||
{% csrf_token %} | ||
<input type="submit" value="Yes, delete" class="btn btn-danger" /> | ||
</form> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding a 'Cancel' button to the form to allow users to easily navigate back if they decide not to delete the manufacturer. This improves the user experience by providing an easy way to cancel the action. |
||
{% endblock %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{% extends "base.html" %} | ||
{% load crispy_forms_filters %} | ||
{% block content %} | ||
<h1>{{ object|yesno:"Update,Create" }} Manufacturer Form</h1> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The use of |
||
<form action="" method="post" novalidate> | ||
{% csrf_token %} | ||
{{ form | crispy }} | ||
<input class="btn btn-primary" type="submit" value="Submit"> | ||
</form> | ||
{% endblock %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block content %} | ||
<h1>Manufacturer List | ||
<h1>Manufacturer List <a class="btn btn-primary" style="float: right" href="{% url 'taxi:manufacturer-create' %}" role="button">Create</a> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure there is consistent spacing around the attributes in the |
||
</h1> | ||
|
||
{% if manufacturer_list %} | ||
|
@@ -10,8 +10,9 @@ <h1>Manufacturer List | |
<th>ID</th> | ||
<th>Name</th> | ||
<th>Country</th> | ||
<th>Update</th> | ||
<th>Delete</th> | ||
</tr> | ||
|
||
{% for manufacturer in manufacturer_list %} | ||
<tr> | ||
<td> | ||
|
@@ -23,10 +24,15 @@ <h1>Manufacturer List | |
<td> | ||
{{ manufacturer.country }} | ||
</td> | ||
<td> | ||
<a href="{% url 'taxi:manufacturer-update' pk=manufacturer.id %}">Update</a> | ||
</td> | ||
<td> | ||
<a href="{% url 'taxi:manufacturer-delete' pk=manufacturer.id %}">Delete</a> | ||
</td> | ||
</tr> | ||
{% endfor %} | ||
</table> | ||
|
||
{% else %} | ||
<p>There are no manufacturers in the service.</p> | ||
{% endif %} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of
select_related
is a good practice for optimizing database queries. Ensure that the related fields are correctly specified and necessary for the view to avoid unnecessary data fetching.