I have custom user model
class User(AbstractUser):
model fields
and another model which has a field with foreign key relation to User
class Comment(models.Model):
writer = models.ForeignKey(User,on_delete=models.CASCADE,null=True,related_name='comment_writer')
contents = models.TextField(max_length=300,null=True)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
but when I makemigrations and migrate the app and the project, I still get error message at the admin page
OperationalError at /admin/User/comment/
no such column: User_comment.writer_id
Request Method: GET
Request URL: http://localhost:8000/admin/User/comment/
Django Version: 2.2.3
Exception Type: OperationalError
Exception Value:
no such column: User_comment.writer_id
Exception Location: /usr/local/lib/python3.6/dist-packages/django/db/backends/sqlite3/base.py in execute, line 383
Python Executable: /usr/bin/python3
Python Version: 3.6.9
Python Path:
['/home/potentad/Documents/timesello',
'/usr/lib/python36.zip',
'/usr/lib/python3.6',
'/usr/lib/python3.6/lib-dynload',
'/home/potentad/.local/lib/python3.6/site-packages',
'/usr/local/lib/python3.6/dist-packages',
'/usr/local/lib/python3.6/dist-packages/onedrived-2.0.0-py3.6.egg',
'/usr/local/lib/python3.6/dist-packages/zgitignore-1.0.0-py3.6.egg',
'/usr/local/lib/python3.6/dist-packages/tabulate-0.8.7-py3.6.egg',
'/usr/local/lib/python3.6/dist-packages/psutil-5.7.0-py3.6-linux-x86_64.egg',
'/usr/lib/python3/dist-packages']
Server time: Fri, 22 May 2020 23:20:23 +0000
What's wrong and what should I do ?
make migrations- Hashir