Reputation: 365
I am following a tutorial as I am fairly new to Django, and I am trying to add a comments system to my blog. However, whenever I try and use it I get an error message saying the following:no such column: blog_comment.body
. I am not sure what is going on, as in my model I have body = models.TextField()
, and I am just generally very confused.
Upvotes: 0
Views: 763
Reputation: 12086
This is because you have not run migrations in order to apply the body
column to the database.
Just run ./manage.py makemigrations
and ./manage.py migrate
Django will ask you to enter a default value since you have declared the body
field as not nullable.
If you don't want to enter a default value, write it like this:
body = models.TextField(blank=True, null=True)
and then run the same commads.
Upvotes: 1