Opened 7 months ago

Closed 7 months ago

Last modified 7 months ago

#21087 closed Bug (wontfix)

"datatime" objects can not be JSON-serialized to be held in sessions

Reported by: epandurski@… Owned by: nobody
Component: Core (Serialization) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I am using Django 1.6 beta 3.

In my view I try:

now =
request.session['lstts'] = now

But I get the following error:

I presume the reason is the new serializer for session objects. I also presume that "datatime" objects must be supported, because they are quite useful and used.

Attachments (0)

Change History (3)

comment:1 Changed 7 months ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

The JSON format doesn't provide a type for dates/datetimes. We'll have to resort to a hack to support this use case.

comment:2 Changed 7 months ago by timo

  • Resolution set to fixed
  • Status changed from new to closed

This was discussed quite a bit during the implementation, and the caveats of JSON serialization have been documented:

You can continue to use the PickleSerializer if needed.

comment:3 Changed 7 months ago by timo

  • Resolution changed from fixed to wontfix

Add Comment

Modify Ticket

Change Properties
<Author field>
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.