mdn / django-locallibrary-tutorial

Local Library website written in Django; example for the MDN server-side development Django module: https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Recommend change from "author" to "book" in book_confirm_delete.html

nhenyon opened this issue · comments

In the MDN Django Tutorial Part9, challenge, I tried the github code in book_confirm_delete.html, and found that it will lead to prompting the user attempting to delete a book record, whether they want to delete the author, where the prompt should be whether they want to delete the specific book that is numbered in the URL. The other files in github for this section are fine including sections of urls.py, views.py, and book_form.html

I recommend the following change in book_confirm_delete.html:

from:

{% extends "base_generic.html" %}
{% block content %}

Delete Author

Are you sure you want to delete the author: {{ author }}?

{% csrf_token %} {% endblock %}

to:

{% extends "base_generic.html" %}
{% block content %}

Delete Book

Are you sure you want to delete the book: {{ book }}?

{% csrf_token %} {% endblock %}

There is no issue. I didn't realize there is a more recent version of the file. The earlier version of the file book_confirm_delete.html from 2016 has the issue, while the newer version in 2017 is correct, with the change from "author" to "book".