Documentation 'Selecting the current time zone' code error
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)
Description: |
modified (diff)
|
Triage Stage: |
Unreviewed → Accepted
|
Version: |
5.2 → dev
|
Owner: |
set to YQ
|
Status: |
new → assigned
|
Triage Stage: |
Accepted → Ready for checkin
|
Resolution: |
→ fixed
|
Status: |
assigned → closed
|
Thank you!