[Answer]-ModelForeign key fails to create a column id linked to the object in Django

1👍

Seems that you modified your database schema after creating the database.

You need to migrate your apps or recreate your database if you don’t have any data.
To migrate your apps, try South. To recreate the database, for example if you are using SQLite, you can just delete the database file specified in your settings, and the run syncdb command again.

0👍

Did you create the database tables, then changed the models?

Django does not keep the database and the models in sync, you either need to use South for that, or destroy and rebuild the database when you change the models.

👤krs

0👍

Have you ran python manage.py syncdb command after defining your models.py ?

Leave a comment