修改polls包里面的apps.py
from django.apps import AppConfig
class PollsConfig(AppConfig):
name = 'polls'
verbose_name = '投票'
修改polls包里面的models.py
from django.db import models
# Create your models here.
# 在我们的polls应用程序中,
# 将创建两个模型:Question和Choice,
# Question有一个问题和一个出版日期,
# Choice有两个领域:选择的文本和票数,
# 每个Choice都关联一个Question
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('出版日期')
class Meta:
verbose_name = '问题'
verbose_name_plural = '问题'
class Choice(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
class Meta:
verbose_name = '选择'
verbose_name_plural = '选择'
python manage.py runserver
启动