Learn from Daniel’s website:
After the models class is modified, the database should also be updated. However, the syncdb command only creates tables in the database and does not modify or delete the data model synchronously. At this time, you need to manually make corresponding modifications in the database or run syncdb to recreate the table before deleting it.
Manual modification process:
1. sudo python manage.py sqlall depotapp View all fields of the table
2. sudo python manage.py dbshell Use the dbshell provided by django to add fields
sqlite> begin;
sqlite> alter table depotapp_product add column date_available data not null default 0;
sqlite> commit;
{ctrl+d when exiting}{delete field-->drop column;delete model-->drop table;delete many-to-many association-->drop table( Automatically generated association table)}
3. python manage.py shell to verify the database
In [1]: from depotapp.models import Product
In [2]: Product.objects.all()
If no error is reported, it is ok