Hello, I pickled a dictionary and stored it in my database like this:
article.rating = article.rating + 1
ratings[request.user.username] = 1
article.rating_list = pickle.dumps(ratings)
article.save()
ratings looks like this:
{'froob': 1, 'alik': 1, 'teth': 1}
When I try and load the pickled string from the database it gives me
the following error:
KeyError at /article/testing123/up/
'\x00'
article/testing123 loads the article testing123 from the database and
the /up/ is to improve the rating of it. The dictionary is to prevent
users from rating the same article twice by putting their username as
an index in a dictionary. What am I doing wrong? (The pickled string
is stored in a TEXT field)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---