[Answer]-Django/RapidSMS Foreignkey not a column in table


What manage.py sql voting says is the SQL that wold be generated if Django was going to create the tables. It does not output the current state of the tables nor does it apply the SQL that it outputs. Likewise manage.py sqlclear voting shows the SQL to clear the tables but does not apply it to the database.

I added poll = models.ForeignKey(Poll) after I had made a table for Choice…

There is your problem. syncdb does not alter existing tables. You need to either alter the table yourself or drop and have Django recreate it (if you don’t have any data worth keeping).

Leave a comment