#23596: request.session.save() raise TypeError: [<Group: Admin user>] is not
JSON
serializable
-------------------------------------+-------------------------------------
Reporter: caot | Owner: nobody
Type: Bug | Status: closed
Component: contrib.sessions | Version: 1.7
Severity: Normal | Resolution: invalid
Keywords: session save | Triage Stage:
serializer dumps JSON | Unreviewed
serializable | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 1
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by charettes):
* status: new => closed
* needs_docs: => 0
* resolution: => invalid
* needs_tests: => 0
* needs_better_patch: => 0
Comment:
For [https://docs.djangoproject.com/en/1.7/topics/http/sessions/#session-
serialization documented security reasons] sessions are serialized using
JSON instead of `pickle` since Django 1.6.
If you want to store a collection of model instances using
`django.contrib.sessions.serializers.JSONSerializer` I suggest you convert
it to a list of primary keys instead:
{{{#!python
sessions['groups'] = [group.pk for group in groups]
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23596#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/062.57a8d63b307068293136bb8bbc87051d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.