python - Why is save not working in Django? -


i'm using manage.py shell , run this:

>>>d=document.objects.get(pk=1)
>>>d.scores
{1:0,2:0,3:0}
>>>d.scores[1]=5
>>>d.scores
{1:5,2:0,3:0}
>>>d.save()

but viewing d in database reveals hasn't been updated. doing wrong?? checked out what's here, d document instance.

if helps, model.py looks this:

from django.db import models
class document(models.model):
filename=models.charfield(max_length=200)
fileurl=models.charfield(max_length=200)
scores={1:0,2:0,3:0}

your 'scores' class variable isn't instance of of django's *field classes. imagine 'scores' field isn't on table in db, since field classes defines of that, , gets saved db, among other things.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -