Home > Articles > Open Source > Python

  • Print
  • + Share This
This chapter is from the book


  • Q. How do I modify a model after it has been synced to the database?

    A. Currently, Django cannot update models reliably. The safest and easiest method to modify an existing model is to make changes to the model and then delete all tables related to the model in the database using the SQL drop command. Finally, use the syncdb command to sync the model with the database.

  • Q. Is there a way to check for errors in my model before trying to sync to the database?

    A. Django has a utility to validate the contents of models before syncing to the database. From the root directory of the project, enter python manage.py validate. The validate utility checks the model's syntax and logic and reports any problems.

  • + Share This
  • 🔖 Save To Your Account