Easiest way to rename a model using Django/South?

后端 未结 4 1799
無奈伤痛
無奈伤痛 2020-11-29 15:44

I\'ve been hunting for an answer to this on South\'s site, Google, and SO, but couldn\'t find a simple way to do this.

I want to rename a Django model using South.

4条回答
  •  天命终不由人
    2020-11-29 15:59

    I followed Leopd's solution above. But, that did not change the model names. I changed it manually in the code (also in related models where this is referred as FK). And done another south migration, but with --fake option. This makes model names and table names to be same.

    Just realized, one could first start with changing model names, then edit the migrations file before applying them. Much cleaner.

提交回复
热议问题