AttributeError: module 'django.db.models' has no attribute 'DataField'

AttributeError: module 'django.db.models' has no attribute 'DataField'

我尝试了 运行 我的服务器然后我得到了这个 updated_at=models.DataField(auto_now_add=True) AttributeError: module 'django.db.models' has no attribute 'DataField'

根据错误行,这里是检测到错误的确切代码。

    id=models.AutoField(primary_key=True)
    name=models.CharField(max_length=225)
    email=models.CharField(max_length=224)
    password=models.CharField(max_length=225)
    created_at=models.DateField(auto_now_add=True)
    updated_at=models.DataField(auto_now_add=True)
    objects=models.Manaager()

请帮助我,因为我是新手 python

您写的是 DataField,而应该是 DateField。 另外 Manaager 应该是 Manager。 您的代码应如下所示:

    id=models.AutoField(primary_key=True)
    name=models.CharField(max_length=225)
    email=models.CharField(max_length=224)
    password=models.CharField(max_length=225)
    created_at=models.DateField(auto_now_add=True)
    updated_at=models.DataField(auto_now_add=True)
    objects=models.Manager()