We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Beyond the Basics of Migrations with Charlotte Mays
Learn how to make the most of Django's migration system with expert Charlotte Mays, covering essential best practices and pitfalls to avoid in model changes, field definitions, and more.
- 
Use get_modelto retrieve the correct model version, rather than importing models directly.
- 
When making changes to a model, make sure to use the get_modelfunction to ensure the changes are applied correctly.
- 
When running migrations, use migrations.runPython.noopinstead ofmigrations.runPythonwithout thenoopparameter to avoid unexpected behavior.
- When creating a new model, use the correct field definition to avoid importing the wrong model.
- 
When renaming a field or model, use RenameFieldinstead of directly modifying the field definition.
- When making changes to a field, use the correct field type and attributes to ensure the changes are applied correctly.
- 
When using runPython, use thenoopparameter to indicate that no reverse operation is needed.
- 
When creating a new migration, include a logical name and use the get_modelfunction to retrieve the correct model version.
- 
Use the get_modelfunction to retrieve the correct model version, rather than importing models directly.
- Before making changes to a model, check that the changes will not conflict with other migrations.
- When creating a new model, use the correct field definition to avoid importing the wrong model.
- 
When renaming a field or model, use RenameFieldinstead of directly modifying the field definition.
- When making changes to a field, use the correct field type and attributes to ensure the changes are applied correctly.
- 
When using runPython, use thenoopparameter to indicate that no reverse operation is needed.
- 
When creating a new migration, include a logical name and use the get_modelfunction to retrieve the correct model version.