python - Django: Field 'X' doesn't have a default value -


the models.py of table :

class testcaseglobalmetricdata(models.model):     testrundata = models.foreignkey(testrundata)     testcase = models.charfield(max_length=200)     cvmtotalfree = models.integerfield(default=0)     systemfree = models.integerfield(default=0)     sharedmemory = models.integerfield(default=0) 

and part of code uses table

testcaseglobalmetricdata(testrundata=testrundataobj,                     testcase=tokens['tc_name'],                     timestamp=tokens['timestamp'],                     cvmtotalfree=totalfree).save() 

when line executed following error seen,

file "/web/memmon/eink-memmon/projects/process.py", line 382, in process_cvm_usage     cvmtotalfree=totalfree).save()  .....  warning: field 'sharedmemory' doesn't have default value 

i tried inserting table using python manage.py shell , works fine.

the schema of table seen in mysql is

+-----------------+--------------+------+-----+---------+----------------+ | field           | type         | null | key | default |          | +-----------------+--------------+------+-----+---------+----------------+ | id              | int(11)      | no   | pri | null    | auto_increment |  | testrundata_id  | int(11)      | no   | mul | null    |                |  | testcase        | varchar(200) | no   |     | null    |                |  | cvmtotalfree    | int(11)      | no   |     | null    |                |  | systemfree      | int(11)      | no   |     | null    |                |  | sharedmemory    | int(11)      | no   |     | null    |                |  +-----------------+--------------+------+-----+---------+----------------+ 

note: field sharedmemory added in models.py today. did proper migrations using makemigrations , migrate commands.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -