python - South unable to create new field because field does not exist -
i'm trying use south add new urlfield model, like:
class document(models.model): text = models.textfield() reference_page = models.urlfield(blank=true, null=true) source_page = models.urlfield(blank=true, null=true) # new field however, when run python manage.py schemamigration myapp --auto error:
databaseerror: column myapp_document.source_page not exist line 1: ...ext", "myapp_document"."reference_page", "myapp_doc... i'm using postgresql db backend. initialized app south , have run migrations it. i've made sure django , south installs date.
why giving me error now?
edit: oddly, if manually created column in database, schemamigration call succeeds, of course migrate call fails until manually remove column. bizarre.
i have been dealing issue couple months. link shared montiniz in comment on other answer had 0-voted answer resolved issue! i'm posting here else.. build community of knowledge , that.
problem: schemamigration [app] --auto fails complaint missing column (often new field trying migrate schema ...)
in case, complain when modifying workgroup model (a models.py model) not other models.
solution: model has default keyword argument in foreignkey relation references model failing migrate.
workgroup = models.foreignkey('core.workgroup', default=get_default_workgroup, null=true)
if remove default keyword argument, run management command, should succeed. then, add original default argument back.
Comments
Post a Comment