我收到此错误的Django的模型:Django的给神秘的错误为外键
ProgrammingError at /admin/notifications/eventtoken/ column notifications_eventtoken.user_id does not exist LINE 1: ...ications_eventtoken" INNER JOIN "users_user" ON ("notificat... ^ HINT: Perhaps you meant to reference the column "notifications_eventtoken.used_at".
我添加了用户这样一个外键:
class EventToken(models.Model):
token = models.CharField(max_length=255, db_index=True)
user = models.ForeignKey(User, null=False, blank=False)
used_at = models.DateTimeField(null=True, blank=True)
event = models.ForeignKey(Event)
它的工作原理,当我删除用户字段,但除此之外,我不能告诉错误信息。
您可以添加完整的错误堆栈跟踪吗? –
您是否在添加新的'user'字段后运行迁移?即您的数据库表是否与您的模型保持同步? –