[Django]-Can't pickle dictionary in django

2👍

If you are using datetime objects for created_at and duration, make sure you render them to strings.

1👍

Pickle does not deal well with functions.

Check out this answer for some insight: https://stackoverflow.com/a/1253813/4225229

You could serialize the result of the function (try json.dumps()) and cache that.

0👍

I converted the dictionary with json as Jacob suggested like this:

cache.set('podcasts', json.dumps(podcasts))
👤Atma

Leave a comment