django,当添加新模型字段时显示错误

时间:2019-03-18 08:13:46

标签: django

以前的班级是

class room(models.Model):
    name = models.CharField(max_length=60)
    r = models.IntegerField()
    c = models.IntegerField()    
    total = models.IntegerField()
    inv1 = models.CharField(max_length=60, default = 'None')
    inv2 = models.CharField(max_length=60, default = 'None')
    inv3 = models.CharField(max_length=60, default = 'None')

我添加了t = models.IntegerField(default = 10)。迁移时,它显示错误

正在运行的迁移:   正在应用allotment.0007_auto_20190316_2314 ...回溯(最近一次通话):   在第15行的文件“ manage.py”中     execute_from_command_line(sys.argv)   文件“ C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ django \ core \ management__init __。py”,行381,位于execute_from_command_line中     utility.execute()   在执行中的文件“ C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ django \ core \ management__init __。py”,行375     self.fetch_command(子命令).run_from_argv(self.argv)   在run_from_argv中的第316行中,文件“ C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ django \ core \ management \ base.py”     self.execute(* args,** cmd_options)   执行中的文件“ C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ django \ core \ management \ base.py”,行353     输出= self.handle(* args,** options)   文件“ C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ django \ core \ management \ base.py”,第83行,已包装     res = handle_func(* args,** kwargs)   句柄中的文件“ C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ django \ core \ management \ commands \ migrate.py”,第203行     fake_initial = fake_initial,   迁移中的文件“ C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ django \ db \ migrations \ executor.py”,行117     状态=自我._migrate_all_forwards(状态,计划,完整计划,假=假,假初始=假初始)   _migrate_all_forwards中的第147行的文件“ C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ django \ db \ migrations \ executor.py”     状态= self.apply_migration(状态,迁移,fake = fake,fake_initial = fake_initial)   文件“ C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ django \ db \ migrations \ executor.py”,行244,位于apply_migration中     状态= migration.apply(状态,schema_editor)   文件“ C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ django \ db \ migrations \ migration.py”,适用于第124行     operation.database_forwards(self.app_label,schema_editor,old_state,project_state)   文件“ C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ django \ db \ migrations \ operations \ fields.py”,第84行,在database_forwards中     领域,   在add_field的第300行中输入文件“ C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ django \ db \ backends \ sqlite3 \ schema.py”     self._remake_table(model,create_field = field)   _remake_table中的第172行的文件“ C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ django \ db \ backends \ sqlite3 \ schema.py”     self.effective_default(create_field)   第239行中的文件“ C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ django \ db \ backends \ base \ schema.py”,有效_默认     返回field.get_db_prep_save(默认,self.connection)   在get_db_prep_save中的第790行,文件“ C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ django \ db \ models \ fields__init __。py”     返回self.get_db_prep_value(值,连接=连接,准备=假)   文件“ C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ django \ db \ models \ fields__init __。py”,行785,在get_db_prep_value中     值= self.get_prep_value(值)   文件“ C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ django \ db \ models \ fields__init __。py”,行1807,在get_prep_value中     返回int(值) ValueError:int()以10为底的无效文字:“无”

0 个答案:

没有答案