Django :"models.py"文件中未定义的属性



My "models.py"文件有以下代码:

from django.db import models
# Create your models here.
class Questions(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
class  Choice (models.Model):  
choice_text =  models.CharField(max_length=200)
votes = models.IntegerFeild(default = 0 )
question =  models.ForeignKey(Question, on_delete=models.CASCADE)  

我在运行代码时得到的错误是:

votes = models.IntegerFeild(default = 0 )
AttributeError: module 'django.db.models' has no attribute 'IntegerFeild'

你的models.py中有一个错别字,你可以这样修复它:-

votes = models.IntegerField(default = 0 )

最新更新