#21487 closed Bug (fixed)
Incorrect documentation on using timezones and session in 1.6
Reported by: | filipp | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.6 |
Severity: | Normal | Keywords: | session, timezone, json |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
The 1.6 documentation on using Time zones (https://docs.djangoproject.com/en/1.6/topics/i18n/timezones/) says it's OK to do this:
request.session['django_timezone'] = pytz.timezone(request.POST['timezone'])
However that does not work since 1.6 with the default session serializer (serializers.JSONSerializer), resulting instead in a crash (TypeError), similar to this:
<DstTzInfo 'Europe/Stockholm' CET+1:00:00 STD> is not JSON serializable
Would be nice if the 1.6 documentation was be updated to say how this should be done since 1.6.
Change History (5)
comment:1 by , 11 years ago
Easy pickings: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:3 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Yes, it should either be noted that the code only works with a non-default session serializer or better yet, fix the code so that it works with any session serializer.