标签:
from django.db import models # Create your models here. class Question(models.Model): question_text = models.CharField(max_length=200) pub_date = models.DateTimeField(‘date published‘) class Choice(models.Model): question = models.ForeignKey(Question) choice_text = models.CharField(max_length=200) votes = models.IntegerField(default=0)
? mysite python manage.py makemigrations polls Migrations for ‘polls‘: 0001_initial.py: - Create model Choice - Create model Question - Add field question to choice
? 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.0001_initial... OK
标签:
原文地址:http://www.cnblogs.com/s380774061/p/5006635.html