Django TutorialLesson 15Free preview
Django Update Model
This lesson is part of Django · All levels
Summary
When the model structure needs to change, you edit the field in models.py and then make a new migration. Django detects changes and generates migration files that can be applied to the migrate. So the table is updated without deleting the old data.
Key points
- Edit field in models.py to change the structure
- Run emigrations to make migration
- Run the migration to implement the change
- Old data is generally kept secure when adding columns
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.