#35461 closed Cleanup/optimization (fixed)
Tutorial instructions for adding django-debug-toolbar are misleading.
Reported by: | dawbert | Owned by: | Rosana Rufer |
---|---|---|---|
Component: | Documentation | Version: | 5.0 |
Severity: | Normal | Keywords: | |
Cc: | Timothy Schilling, Mariusz Felisiak, Adam Johnson, Ryan Cheley | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Hey folks!
The instructions in step 8 of the tutorial recommend adding the django-debug-toolbar as a way to understand third-party apps, etc, but it doesn't work without additional changes to the mysite project.
https://docs.djangoproject.com/en/5.0/intro/tutorial08/#installing-django-debug-toolbar
It finishes by saying, "Once installed, you should be able to see the DjDT “handle” on the right side of the browser window when you refresh the polls application."
However, the panel only shows if the view has a "</body>" tag, which none of the views you write have.
Suggest either adding the body tag into the earlier pages, updating the documentation to say you need to add them, or using a different addon as an example.
Change History (14)
comment:1 by , 6 months ago
Cc: | added |
---|---|
Summary: | Tutorial instructions for adding third-party app don't work → Tutorial instructions for adding django-debug-toolbar are misleading. |
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Bug |
comment:2 by , 6 months ago
Oh, I didn't realize there wasn't an actual valid HTML template earlier in the tutorial.
I see three options right now:
- Add steps manipulating one view's response to include the proper HTML tags
- Include a new advanced tutorial demoing template inheritance where it uses the proper HTML tags
- Refer the user to the admin interface on their app to see the toolbar and explain why it doesn't show for the other views
comment:3 by , 6 months ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
This can be fixed after adding body tag in html files, we can add documentation citing that body tag is required for toolbar handle.
Should I pick this issue?
follow-up: 6 comment:4 by , 5 months ago
Cc: | added |
---|---|
Type: | Bug → Cleanup/optimization |
This was already raised and clarified in tutorial 3:
"To make the tutorial shorter, all template examples use incomplete HTML. In your own projects you should use complete HTML documents."
Check out 26be53dd89cef46746b4a67cbc0bb29665e999a6.
comment:5 by , 5 months ago
Owner: | removed |
---|---|
Status: | assigned → new |
comment:6 by , 5 months ago
Cc: | added |
---|
Replying to Mariusz Felisiak:
This was already raised and clarified in tutorial 3:
"To make the tutorial shorter, all template examples use incomplete HTML. In your own projects you should use complete HTML documents."
Check out 26be53dd89cef46746b4a67cbc0bb29665e999a6.
Looks like this note was added based off this forum question: https://forum.djangoproject.com/t/are-html-tags-needed-in-templates/806/1
Personally, I still think a clarification is required as this note says "in your own projects" rather than that this is requirement for part 8 of the tutorial to work as expected
comment:7 by , 5 months ago
Cc: | added |
---|
comment:8 by , 5 months ago
Owner: | set to |
---|---|
Status: | new → assigned |
I've been working on this and looking and testing the issue from different perspectives and I've got a proposal.
Total options proposed by participants:
- Option A - Add the body tag in earlier pages.
- Option A.2 - Add a new step using template inheritance.
- Option B - Use a different addon as example.
- Option C - Suggest looking at the toolbar in /admin and explain what needs tweaking for it to work in /polls.
Discussion timeline:
- Dawbert (Reporter) says: Following the tutorial gives wrong results when installing django-debug-toolbar as templates need to be wrapped in complete HTML but the tutorial doesn’t do it for brevity. Proposing options A and B
- Sarah agrees Django documentation needs tweaking. Mentions the body tag requirement is already documented in the official django-toolbar app.
- Timothy offers options A, A.2 and C
My Conclusion: It’s worth doing option C.
Reasoning:
- The main goal of this section is to learn how to add a package in the first place and a bit of django-debug-toolbar in second place. Option C provides both quickly in
/admin
, additionally providing a pointer on how to see such toolbar in/polls
- Most people following this tutorial will trip on this step for many reasons* and it’s worth improving this.
Pull Request with proposed change: https://github.com/django/django/pull/18285
📝 Notion with extended reasoning here: https://www.notion.so/Tutorial-instructions-for-adding-django-debug-toolbar-are-misleading-1f1429081df4473cb5bad80790cc4176
comment:9 by , 5 months ago
Description: | modified (diff) |
---|---|
Has patch: | set |
comment:10 by , 5 months ago
Patch needs improvement: | set |
---|
comment:11 by , 5 months ago
Patch needs improvement: | unset |
---|
comment:12 by , 5 months ago
Triage Stage: | Accepted → Ready for checkin |
---|
Hi dawbert, thank you for raising! I agree this is not the best experience for a tutorial and the docs are misleading.
This body tag requirement is documented in the django-debug-toolbar docs so I don't think this is a bug in
django-debug-toolbar
, we should make a tweak 👍