Django 错误信息:AttributeError: 'str' object has no attribute '_meta'

这个错误的原因是不恰当地使用了字符串形式的表名作为外键关联:

user = models.ForeignKey('User')

改成这样就可以了:

user = models.ForeignKey(User)


posted on 2007-08-08 18:02  NeilChen  阅读(2970)  评论(8)    收藏  举报

导航