django foreignkey(user) in models

后端 未结 4 1142
臣服心动
臣服心动 2020-12-31 00:23

I read the docs and this post... Django - Foreign Key to User model

I followed what it said and I still cannot get it to work. When I try to run the migrations I get

4条回答
  •  甜味超标
    2020-12-31 00:56

    the column "author_id" doesn't exist, looks like is the same problem from here : Django suffix ForeignKey field with _id , so to avoid this traceback you may use :

    author = models.ForeignKey(User, db_column="user")
    

提交回复
热议问题