2👍
✅
You need to use Django’s migrations, which will allow you to add the field to the database.
In short, you make the change to your model, create a migration with manage.py makemigrations
, and then run it with manage.py migrate
.
0👍
Sounds like you need to migrate your database after adding the new column. Its like when you use the syncdb command to do the “create table” commands when first creating your database, the migrations will write “alter table” changes to your database.
0👍
It turns out I had missed that the migrate command requires the app name. So, I had to run the command like this:
manage.py makemigrations app_name
- [Answer]-Django CreateView demands pk
- [Answer]-Django: How to upload file without UnicodeEncodeError on save()?
- [Answer]-Python social auth linkedin picture url is null
- [Answer]-Creating tree editor for mptt model in django admin
-1👍
By default BooleanField
column is False, you don’t need to specify anything. Just run python manage.py migrate
. It should work.
👤Ajai
- [Answer]-How to manage media files on Windows?
- [Answer]-Modify db object field from .py file in django
Source:stackexchange.com