Opened 6 months ago

Last modified 6 months ago

#36254 closed Bug

Documentation 'Selecting the current time zone' code error — at Initial Version

Reported by: YQ Owned by:
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

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 %}

Change History (0)

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