python 2.7 - Django/RapidSMS Foreignkey not a column in table -


so i'm working rapidsms builds on django , i'm trying sort of combine tutorials poll app in django , thevoting app in rapidsms started voting , trying expand using code django tutorial when ran trouble. (i'm using python27 on windows7 64bit, django 1.5, , sqlite3) here's have in voting.models

from django.db import models django.utils import timezone    # create models here.  class poll(models.model):     question = models.charfield(max_length=200)     pub_date = models.datetimefield('date published')     def __unicode__(self):           return self.question     def was_published_recently(self):         return self.pub_date >= timezone.now() - datetime.timedelta(days=1) class choice(models.model):     poll = models.foreignkey(poll)     name = models.charfield(max_length=40, unique=true)     votes = models.integerfield(default=0)     def __unicode__(self):         return self.name 

the poll part shows fine on admin, can question , date, when try add choice, or touch choices @ error "table voting_choice has no column named poll_id"

i added poll = models.foreignkey(poll) after had made table choice, thought might problem after research (maybe still is) got impression tables weren't being written over. did :

>manage.py sqlclear voting begin; drop table "voting_choice"; drop table "voting_poll";  commit;  >manage.py sql voting begin; create table "voting_poll" (     "id" integer not null primary key,     "question" varchar(200) not null,     "pub_date" datetime not null ) ; create table "voting_choice" (     "id" integer not null primary key,     "poll_id" integer not null references "voting_poll" ("id"),     "name" varchar(40) not null unique,     "votes" integer not null ) ;  commit; 

so /says/ has column here. syncdb, migrate measure , runserver, or shell , either way entering poll question/date fine, once try add choice or @ created poll, above mentioned error. voting included in installed_apps. being django newbie, i'm lost. if has more suggestions try appreciated.

thanks, lizzy

what manage.py sql voting says sql wold generated if django going create tables. not output current state of tables nor apply sql outputs. likewise manage.py sqlclear voting shows sql clear tables not apply database.

i added poll = models.foreignkey(poll) after had made table choice...

there problem. syncdb not alter existing tables. need either alter table or drop , have django recreate (if don't have data worth keeping).


Comments