[Django] #36254: Documentation 'Selecting the current time zone' code error

15 views
Skip to first unread message

Django

unread,
Mar 14, 2025, 5:42:50 AMMar 14
to django-...@googlegroups.com
#36254: Documentation 'Selecting the current time zone' code error
--------------------------------+-----------------------------------------
Reporter: YQ | Type: Bug
Status: new | Component: Documentation
Version: 5.2 | Severity: Normal
Keywords: timezone items | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+-----------------------------------------
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 %}
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36254>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 14, 2025, 5:50:17 AMMar 14
to django-...@googlegroups.com
#36254: Documentation 'Selecting the current time zone' code error
--------------------------------+--------------------------------------
Reporter: YQ | Owner: (none)
Type: Bug | Status: new
Component: Documentation | Version: 5.2
Severity: Normal | Resolution:
Keywords: timezone items | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------
Changes (by YQ):

* has_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36254#comment:1>

Django

unread,
Mar 14, 2025, 5:56:43 AMMar 14
to django-...@googlegroups.com
#36254: Documentation 'Selecting the current time zone' code error
--------------------------------+--------------------------------------
Reporter: YQ | Owner: (none)
Type: Bug | Status: new
Component: Documentation | Version: 5.2
Severity: Normal | Resolution:
Keywords: timezone items | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------
Description changed by YQ:

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

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


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

--
--
Ticket URL: <https://code.djangoproject.com/ticket/36254#comment:2>

Django

unread,
Mar 14, 2025, 7:12:53 AMMar 14
to django-...@googlegroups.com
#36254: Documentation 'Selecting the current time zone' code error
--------------------------------+------------------------------------
Reporter: YQ | Owner: (none)
Type: Bug | Status: new
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: timezone items | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------
Changes (by Sarah Boyce):

* stage: Unreviewed => Accepted
* version: 5.2 => dev

Comment:

Thank you!
--
Ticket URL: <https://code.djangoproject.com/ticket/36254#comment:3>

Django

unread,
Mar 14, 2025, 12:04:36 PMMar 14
to django-...@googlegroups.com
#36254: Documentation 'Selecting the current time zone' code error
-------------------------------------+-------------------------------------
Reporter: YQ | Owner: YQ
Type: Bug | Status: assigned
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: timezone items | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* owner: (none) => YQ
* stage: Accepted => Ready for checkin
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/36254#comment:4>

Django

unread,
Mar 17, 2025, 4:45:26 AMMar 17
to django-...@googlegroups.com
#36254: Documentation 'Selecting the current time zone' code error
-------------------------------------+-------------------------------------
Reporter: YQ | Owner: YQ
Type: Bug | Status: closed
Component: Documentation | Version: dev
Severity: Normal | Resolution: fixed
Keywords: timezone items | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce <42296566+sarahboyce@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"30e0a43937e685083fa1210c3594678a3b813806" 30e0a43]:
{{{#!CommitTicketReference repository=""
revision="30e0a43937e685083fa1210c3594678a3b813806"
Fixed #36254 -- Fixed template dictionary unpacking in
docs/topics/i18n/timezones.txt.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36254#comment:5>

Django

unread,
Mar 17, 2025, 4:48:33 AMMar 17
to django-...@googlegroups.com
#36254: Documentation 'Selecting the current time zone' code error
-------------------------------------+-------------------------------------
Reporter: YQ | Owner: YQ
Type: Bug | Status: closed
Component: Documentation | Version: dev
Severity: Normal | Resolution: fixed
Keywords: timezone items | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Sarah Boyce <42296566+sarahboyce@…>):

In [changeset:"181280027d998f676e82909c483f4f31e00828db" 1812800]:
{{{#!CommitTicketReference repository=""
revision="181280027d998f676e82909c483f4f31e00828db"
[5.2.x] Fixed #36254 -- Fixed template dictionary unpacking in
docs/topics/i18n/timezones.txt.

Backport of 30e0a43937e685083fa1210c3594678a3b813806 from main.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36254#comment:6>

Django

unread,
Mar 17, 2025, 4:50:31 AMMar 17
to django-...@googlegroups.com
#36254: Documentation 'Selecting the current time zone' code error
-------------------------------------+-------------------------------------
Reporter: YQ | Owner: YQ
Type: Bug | Status: closed
Component: Documentation | Version: dev
Severity: Normal | Resolution: fixed
Keywords: timezone items | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Sarah Boyce <42296566+sarahboyce@…>):

In [changeset:"71558701dfaf74e21160b76056ca7fc93cb2bd2f" 71558701]:
{{{#!CommitTicketReference repository=""
revision="71558701dfaf74e21160b76056ca7fc93cb2bd2f"
[5.1.x] Fixed #36254 -- Fixed template dictionary unpacking in
docs/topics/i18n/timezones.txt.

Backport of 30e0a43937e685083fa1210c3594678a3b813806 from main.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36254#comment:7>
Reply all
Reply to author
Forward
0 new messages