Django – making changes to a model
Unless you get your model/database structure spot on first time, you’ll want to change it. Here is how to keep the database in line with your Django models
- Make a change to your model. For instance, in the books app, to the Author class, add an extra field:
email_address = models.EmailField() - Create the migrations file: python manage.py makemigrations
- Run the migrations file: python manage.py migrate
That’s all. Have a look in the admin panel to see the new field