Django不正确的整数值:第1行的列'is_superuser'为'True'

时间:2014-10-28 11:00:09

标签: python django google-app-engine

我已经使用django-simple-history库在我的一个Django项目中实现了历史记录跟踪,并且它工作正常,直到我开始在我的项目中进行更改以使用Cloud SQL将其移动到Google Application Engine。现在,它似乎在布尔字段上失败并带有以下警告:

Warning at /admin/
Incorrect integer value: 'True' for column 'is_superuser' at row 1

部分代码似乎导致了simple_history / models.py文件中的问题,如果模型中有任何布尔字段,则会在创建历史记录时中断:

def create_historical_record(self, instance, type):
        history_user = getattr(instance, '_history_user', None)
        manager = getattr(instance, self.manager_name)
        attrs = {}
        for field in instance._meta.fields:
            attrs[field.attname] = getattr(instance, field.attname)
        manager.create(history_type=type, history_user=history_user, **attrs)

这可以在我的机器上查找但在谷歌应用引擎上中断。请建议。

更新:已解决

MySQLdb库是我自定义的。通过注释行" BooleanType:Bool2Str",在converter.py脚本中删除了布尔到整数的转换。

1 个答案:

答案 0 :(得分:0)

据我所知,Google云正在支持Django 1.4版本,这可能是理由,在Django 1.5布尔字段更改为true / false而不是0,1之后。

我建议你将当地的django版本更改为1.4并尝试。