Opened 6 months ago

Closed 6 months ago

Last modified 6 months ago

#36254 closed Bug (fixed)

Documentation 'Selecting the current time zone' code error

Reported by: YQ Owned by: YQ
Component: Documentation Version: dev
Severity: Normal Keywords: timezone items
Cc: 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 YQ)

ValueError at /set_timezone/
Need 2 values to unpack in for loop; got 6.
Request Method: GET
Request URL: http://127.0.0.1:8000/set_timezone/
Django Version: 5.2b1
Exception Type: ValueError
Exception Value:
Need 2 values to unpack in for loop; got 6.

common_timezones = {
    "London": "Europe/London",
    "Paris": "Europe/Paris",
    "New York": "America/New_York",
}

...

return render(request, "template.html", {"timezones": common_timezones})

...

# template.html
{% for city, tz in timezones %}  # Error : Need 2 values to unpack in for loop; got 6. 
... 

it should be

{% for city, tz in timezones.items %}

https://github.com/django/django/pull/19270

Change History (7)

comment:1 by YQ, 6 months ago

Has patch: set

comment:2 by YQ, 6 months ago

Description: modified (diff)

comment:3 by Sarah Boyce, 6 months ago

Triage Stage: UnreviewedAccepted
Version: 5.2dev

Thank you!

comment:4 by Sarah Boyce, 6 months ago

Owner: set to YQ
Status: newassigned
Triage Stage: AcceptedReady for checkin

comment:5 by Sarah Boyce <42296566+sarahboyce@…>, 6 months ago

Resolution: fixed
Status: assignedclosed

In 30e0a43:

Fixed #36254 -- Fixed template dictionary unpacking in docs/topics/i18n/timezones.txt.

comment:6 by Sarah Boyce <42296566+sarahboyce@…>, 6 months ago

In 1812800:

[5.2.x] Fixed #36254 -- Fixed template dictionary unpacking in docs/topics/i18n/timezones.txt.

Backport of 30e0a43937e685083fa1210c3594678a3b813806 from main.

comment:7 by Sarah Boyce <42296566+sarahboyce@…>, 6 months ago

In 71558701:

[5.1.x] Fixed #36254 -- Fixed template dictionary unpacking in docs/topics/i18n/timezones.txt.

Backport of 30e0a43937e685083fa1210c3594678a3b813806 from main.

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