Django models.py 편집 후 업데이트

1376 단어 Django
Django의 모델스.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

좋은 웹페이지 즐겨찾기