forked from mdn/django-locallibrary-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expand tutorial to allow proper deletion code (mdn#124)
* Update TestViews - remove deprecation in assertFormError * Minimal changes for 4.2 - inc use STORAGES * Update requirements and fixup whitenoise link * Add settings 4.2 for dj url: * Change gunicorn to version that is supported on railway 21.2.0 * Expand tutorial to allow create/delete/update through UI * Remove supurious git stuff * Minor fixes - layout etc * Views delete * Update catalog/views.py * Update views.py - restore order * minor subedit * Authors with books can't be deleted * Use modern formatting for author string * Update bootstrap to latest * Fix up case on base template * Fix up permissions to use the default ones * Fix up tests for permissions * Minor fixes
- Loading branch information
1 parent
0fcfea3
commit f88794b
Showing
24 changed files
with
942 additions
and
422 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
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
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 |
---|---|---|
|
@@ -8,6 +8,5 @@ | |
{{ form.as_table }} | ||
</table> | ||
<input type="submit" value="Submit"> | ||
|
||
</form> | ||
{% 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
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
14 changes: 14 additions & 0 deletions
14
catalog/templates/catalog/bookinstance_confirm_delete.html
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_generic.html" %} | ||
|
||
{% block content %} | ||
|
||
<h1>Delete Book Copy: {{ bookinstance }}</h1> | ||
|
||
<p>Are you sure you want to delete this copy of the book?</p> | ||
|
||
<form action="" method="POST"> | ||
{% csrf_token %} | ||
<input type="submit" action="" value="Yes, delete."> | ||
</form> | ||
|
||
{% 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,36 @@ | ||
{% extends "base_generic.html" %} | ||
|
||
{% block content %} | ||
|
||
<h1>BookInstance: {{ bookinstance.book.title }}</h1> | ||
|
||
<p><strong>Author:</strong> <a href="{{ bookinstance.book.author.get_absolute_url }}">{{ bookinstance.book.author }}</a></p> | ||
|
||
<p><strong>Imprint:</strong> {{ bookinstance.imprint }}</p> | ||
<p><strong>Status:</strong> {{ bookinstance.get_status_display }} {% if bookinstance.status != 'a' %} (Due: {{bookinstance.due_back}}){% endif %}</p> | ||
|
||
<hr> | ||
<ul> | ||
<li> | ||
<a href="{{ bookinstance.book.get_absolute_url }}">All copies</a></p> | ||
</li> | ||
</ul> | ||
{% endblock %} | ||
|
||
|
||
{% block sidebar %} | ||
{{ block.super }} | ||
|
||
{% if perms.catalog.change_bookinstance or perms.catalog.delete_bookinstance %} | ||
<hr> | ||
<ul class="sidebar-nav"> | ||
{% if perms.catalog.change_bookinstance %} | ||
<li><a href="{% url 'bookinstance-update' bookinstance.id %}">Update BookInstance</a></li> | ||
{% endif %} | ||
{% if perms.catalog.delete_bookinstance %} | ||
<li><a href="{% url 'bookinstance-delete' bookinstance.id %}">Delete BookInstance</a></li> | ||
{% endif %} | ||
</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,13 @@ | ||
{% extends "base_generic.html" %} | ||
|
||
{% block content %} | ||
|
||
<form action="" method="post"> | ||
{% csrf_token %} | ||
<table> | ||
{{ form.as_table }} | ||
</table> | ||
<input type="submit" value="Submit"> | ||
|
||
</form> | ||
{% endblock %} |
Oops, something went wrong.