我的 json 数据看起来像这样
{
"Batch Year": 1998 - 1999,
"Roll Nos": ["36", "125"],
"Student Names": ["xyz", "xxy"],
"Project Name": "IMPLEMENTATIONOF NETWORK SECURITY BY VIRTUAL PRIVATE NETWORK (VPN)",
"Project Supervisor": "abc",
"External Supervisor": "aaa",
"Co-Supervisor": "None",
"Project Id": 155
}
对于这些数据,我在 models.py 中为 Roll Nos 和 Student Names 定义了 ListFields,但是当我使用管理面板在我的数据库中添加数据时,我遇到了错误:
“异常值:无法从 Django Admin 修改无格式字段。”
设置.py
DATABASES = {
'default': {
'ENGINE': 'djongo',
'NAME': 'fypcis_db',
}
模型.py
from __future__ import unicode_literals
from djongo import models
import djongo
class students(models.Model):
batch_year = models.IntegerField(db_column='Batch Year') # Field name made lowercase.
roll_nos = djongo.models.ListField(db_column='Roll Nos',default=True) # Field name made lowercase.
student_name = djongo.models.ListField(db_column='Student Names',default=True) # Field name made lowercase.
project_name = models.CharField(max_length=250, db_column='Project Name',default=True) # Field name made lowercase.
project_supervisor = models.CharField(max_length=250, db_column='Project Supervisor',default=True) # Field name made lowercase.
external_supervisor = models.CharField(max_length=250,db_column='External Supervisor',default=True) # Field name made lowercase.
co_supervisor = models.CharField(max_length=250,db_column='Co-Supervisor',default=True) # Field name made lowercase.
project_id = models.IntegerField(db_column='Project Id') # Field name made lowercase.
请帮我解决这个错误。提前致谢
我正在使用 django 2.2 和 djongo 作为引擎