-
Notifications
You must be signed in to change notification settings - Fork 834
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 #889
base: master
Are you sure you want to change the base?
Solution #889
Changes from 3 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,13 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block content %} | ||
<h1>Deleting Car from the List</h1> | ||
<p><strong>WARNING!</strong> You're trying to delete a car: | ||
<strong>{{ car }}</strong> from the list.</p> | ||
<p>Are you sure want to delete this car? | ||
Press "Submit" button to confirm.</p> | ||
<form action="" method="post"> | ||
{% csrf_token %} | ||
<input type="submit" value="Submit" class="btn btn-danger"> | ||
</form> | ||
{% 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" }} a Car</h1> | ||
<form action="" method="post"> | ||
{% csrf_token %} | ||
{{ form|crispy }} | ||
<input type="submit" value="Submit" class="btn btn-info"> | ||
</form> | ||
{% endblock %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,11 @@ <h1>Car list</h1> | |
</li> | ||
{% endfor %} | ||
</ul> | ||
<form action="{% url "taxi:car-create" %}" method="get"> | ||
{% csrf_token %} | ||
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 CSRF token is unnecessary for a form using the |
||
<input type="submit" value="Add" class="btn btn-success"> | ||
</form> | ||
<br> | ||
{% else %} | ||
<p>There are no cars in taxi</p> | ||
{% endif %} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block content %} | ||
<h1>Deleting Manufacturer from the List</h1> | ||
<p><strong>WARNING!</strong> You're trying to delete a manufacturer: | ||
<strong>{{ manufacturer }}</strong> from the list.</p> | ||
<p>This causes a deleting related cars from the cars list too.</p> | ||
<p>Are you sure want to delete this manufacturer? | ||
Press "Submit" button to confirm.</p> | ||
<form action="" method="post"> | ||
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. Include |
||
{% csrf_token %} | ||
<input type="submit" value="Submit" class="btn btn-danger "> | ||
</form> | ||
{% 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" }} a Manufacturer</h1> | ||
<form action="" method="post"> | ||
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. Include |
||
{% csrf_token %} | ||
{{ form|crispy }} | ||
<input type="submit" value="Submit" class="btn btn-info"> | ||
</form> | ||
{% endblock %} | ||
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. add newline |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,8 @@ <h1>Manufacturer List | |
<th>ID</th> | ||
<th>Name</th> | ||
<th>Country</th> | ||
<th>Update</th> | ||
<th>Delete</th> | ||
</tr> | ||
|
||
{% for manufacturer in manufacturer_list %} | ||
|
@@ -23,10 +25,23 @@ <h1>Manufacturer List | |
<td> | ||
{{ manufacturer.country }} | ||
</td> | ||
<td> | ||
<a href="{% url 'taxi:manufacturer-update' pk=manufacturer.id %}">Update</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. Consider using a form with the |
||
</td> | ||
<td> | ||
<a | ||
href="{% url 'taxi:manufacturer-delete' pk=manufacturer.id %}" | ||
style="color: red;" | ||
>Delete</a> | ||
Comment on lines
+32
to
+35
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 using a form with the |
||
</td> | ||
</tr> | ||
{% endfor %} | ||
</table> | ||
|
||
<br> | ||
<form action="{% url 'taxi:manufacturer-create' %}"> | ||
<input type="submit" value="Add" class="btn btn-success"> | ||
</form> | ||
<br> | ||
{% 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.
It's important to include a CSRF token in forms to protect against CSRF attacks. Add
{% csrf_token %}
inside the form tag.