我正在尝试使用Google API django client lib。为了存储我的Web应用程序的每个用户的凭据,设置了凭据模型:
from oauth2client.django_orm import CredentialsField
class CredentialsModel(models.Model):
id = models.ForeignKey(User, primary_key=True)
credential = CredentialsField()
但是,在尝试使用南迁移添加此模型时,我得到:
Cannot freeze field 'google.credentialsmodel.credential'
(this field has class oauth2client.django_orm.CredentialsField)
South cannot introspect some fields; this is probably because they are custom
fields. If they worked in 0.6 or below, this is because we have removed the
models parser (it often broke things).
To fix this, read http://south.aeracode.org/wiki/MyFieldsDontWork
我阅读了链接文档,但我对如何解决这个问题并不是很清楚。如何编写内省规则?或者我如何解决这个问题,只需在这个时髦的领域添加模型?
答案 0 :(得分:0)
您需要在模型声明之前添加这些行:
from south.modelsinspector import add_introspection_rules
add_introspection_rules([], ["^oauth2client\.django_orm\.CredentialsField"])
这将允许South了解oauth2client.django_orm.CredentialField
并使用其父类定义的内省规则。