Django models.py编辑后更新

Django的models.py文件,修改类的成员名。

1、python manage.py makemigrations

2 、python manage.py migrate


said@said:/mnt/hgfs/codes_shared/web/mysite$ python manage.py makemigrations
Did you rename choice.choice_text to choice.m_choice_text (a CharField)? [y/N] y
Did you rename choice.question to choice.m_question (a ForeignKey)? [y/N] y
Did you rename choice.votes to choice.m_votes (a IntegerField)? [y/N] y
Did you rename question.pub_date to question.m_pub_date (a DateTimeField)? [y/N] y
Did you rename question.question_text to question.m_question_text (a CharField)? [y/N] y
Migrations for 'polls':
  0002_auto_20160831_1719.py:
    - Rename field choice_text on choice to m_choice_text
    - Rename field question on choice to m_question
    - Rename field votes on choice to m_votes
    - Rename field pub_date on question to m_pub_date
    - Rename field question_text on question to m_question_text
said@said:/mnt/hgfs/codes_shared/web/mysite$ python manage.py migrate
Operations to perform:
  Synchronize unmigrated apps: staticfiles, messages
  Apply all migrations: admin, contenttypes, polls, auth, sessions
Synchronizing apps without migrations:
  Creating tables...
    Running deferred SQL...
  Installing custom SQL...
Running migrations:
  Rendering model states... DONE
  Applying polls.0002_auto_20160831_1719... OK


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值