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

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

user = models.ForeignKey('User')

改成这样就可以了:

user = models.ForeignKey(User)


原文地址:https://www.cnblogs.com/RChen/p/848129.html