python - migrating an existing app via south -


i have following model -

class todo(models.model):      todo_title = models.charfield(null=true, blank=true, max_length=200)     todo_status = models.integerfield(choices=task_status, null=true, blank=true)     assigned_to = models.manytomanyfield(orgstaff, null=true, blank=true, related_name='assigned_to')     assigned_by = models.manytomanyfield(orgstaff, null=true, blank=true, related_name='assigned_by')     assigned_time = models.datetimefield(auto_now_add=true)     completed_time = models.datetimefield(null=true, blank=true) 

i run python manage.py convert_to_south todoapp todoapp name of app. run python manage.py migrate todoapp.

once done, add field in above model -

class todo(models.model):      todo_title = models.charfield(null=true, blank=true, max_length=200)     todo_slug = models.slugfield(null=true, blank=true)     todo_status = models.integerfield(choices=task_status, null=true, blank=true)     assigned_to = models.manytomanyfield(orgstaff, null=true, blank=true, related_name='assigned_to')     assigned_by = models.manytomanyfield(orgstaff, null=true, blank=true, related_name='assigned_by')     assigned_time = models.datetimefield(auto_now_add=true)     completed_time = models.datetimefield(null=true, blank=true) 

now schemamigation - python manage.py schemamigration todoapp --auto , python manage.py migrate todoapp doing gives following error -

running migrations taskbase:  - migrating forwards 0002_auto__add_field_todo_todo_slug.  > taskbase:0002_auto__add_field_todo_todo_slug keyerror: u'todo_title' 

any idea why getting error? banged head, unable find reason.

it's possible prefixing 'title' , 'status' 'todo_' causing collision name of table fields. in fact, in database django naming fields todoapp_todo_todo_status, , south might confused. south creative things internally, hence collision. suggest trying:

class todo(models.model):      title = models.charfield(null=true, blank=true, max_length=200)     status = models.integerfield(choices=task_status, null=true, blank=true)     assigned_to = models.manytomanyfield(orgstaff, null=true, blank=true, related_name='assigned_to')     assigned_by = models.manytomanyfield(orgstaff, null=true, blank=true, related_name='assigned_by')     assigned_time = models.datetimefield(auto_now_add=true)     completed_time = models.datetimefield(null=true, blank=true) 

i wanted pedantic, point out todoapp should called todos, won't difference project.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -