Django错误(1054,“字段列表中的未知列'models_author.user'”)

在models.py中,我将“登录”字段的名称更改为“用户”,并添加了其他名称。

即使已执行:Python3 manage.py makemigrations模型,python3 manage.py sqlmigrate模型0001和python3 manage.py migration。 我仍然遇到错误

  

(1054,“字段列表中的未知列'models_author.user'”))。

如果我将字段改回“登录”,则效果很好。 版本Python 3.5.2 django.VERSION(2,2,6,“ final”,0) 数据库在MYSQL中。

Code:Models.py

class Autor(models.Model):
    nombre = models.CharField(max_length=30)
    apellidos = models.CharField(max_length=50)
    usuario=models.CharField(max_length=50)

class Post(models.Model):
    author = models.ForeignKey('auth.User',)
    titulo = models.CharField(max_length=100)
    comentario = models.CharField(max_length=1000)
sl0359 回答:Django错误(1054,“字段列表中的未知列'models_author.user'”)

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3165039.html

大家都在问