Django 1.7删除字段。为Model指定的未知字段(字段) [英] Django 1.7 remove field. Unknown field(s) (field) specified for Model

查看:128
本文介绍了Django 1.7删除字段。为Model指定的未知字段(字段)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序中已经有很多模型。
我已经在我的项目中使用迁移。



但是,当我想从模型中删除一个字段时,makemigration命令显示:

 为模型
指定的未知字段(字段)

其中(fields)等于字段的名称,Model是模型的名称吗?



有没有解决方法问题?

解决方案

您可以尝试使用default ='xxx'修改auto_now和auto_now_add,然后可以调用该字段


I have already many models in my application. I have already used migrations in my project.

But when I want to remove a field from a model, the makemigration command show me :

Unknown field(s) (field) specified for Model

Where (fields) is equal to the field's name and Model is the model's name ?

Do you have any solution to resolve this issue ?

解决方案

You may try modifying auto_now and auto_now_add with default = 'xxx', then the field can be called

这篇关于Django 1.7删除字段。为Model指定的未知字段(字段)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆