Opened 5 months ago

Closed 4 months ago

#36381 closed Cleanup/optimization (wontfix)

Improve tutorial's voting template to show a message when no choices are available

Reported by: Birendra Kumar Sharma Owned by: Birendra Kumar Sharma
Component: Documentation Version: dev
Severity: Normal Keywords: tutorial, documentation, template,
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

In the polls tutorial (polls/detail.html), the template currently loops over choices without showing anything if none exist.
This change adds a condition to display a user-friendly message ("No choices available for this question.") when no choices are present.
This improves clarity for beginners and makes the template more informative without altering existing functionality.

Change History (3)

comment:1 by Tim Graham, 4 months ago

Patch needs improvement: set
Summary: Improve tutorial template to show a message when no choices are availableImprove tutorial's voting template to show a message when no choices are available

I'm not in love with the suggestion, but I'll leave the ticgket open for a second opinion. Tutorial 2 already shows how to add choices to a question, so that proposed section redundant. Tutorial 3 already shows how to use {% if %} / {% else %} to show a "No items available" message. Finally, the patch contains some unneeded indentation changes.

comment:2 by Antoliny, 4 months ago

Owner: set to Birendra Kumar Sharma
Status: newassigned

comment:3 by Sarah Boyce, 4 months ago

Resolution: wontfix
Status: assignedclosed

I agree with Tim here
I don't see a strong reason why adding more logic makes this clearer. I feel the tutorial should keep logic simple and focus on the concepts it's trying to introduce.
A question is not really "valid" without choices. The detail view also doesn't have an if/else condition. The user of the tutorial can make their own extensions adding logic to handle this

If you disagree, you can bring this up on the forum and add more reasoning: https://forum.djangoproject.com/c/internals/5

Note: See TracTickets for help on using tickets.
Back to Top