AttributeError:模块“ django.db.models”没有属性“ PositiveSmallIntgerField”

时间:2018-10-14 09:32:36

标签: python django

我是Django的初学者,我在运行manage.py runserver时就开始遇到此问题

这是我的models.py文件

from django.db import models

# Create your models her
class Product(models.Model):
Product_ID = models.IntegerField(primary_key = True)
Name = models.CharField(max_length=264)
Price = models.DecimalField(decimal_places=2, max_digits=5)
Quantity = models.PositiveSmallIntgerField(default=1)
Reviews = models.TextField()

def _str_(self):
   return self.Name

class Buyer(models.Model):
Buyer_ID = models.IntegerField(unique=True)
Name = models.CharField(max_length=264)
DOB = models.DateField(auto_now=False, auto_now_add=False)
Address = models.CharField(max_length=264)
Sex = models.CharField(max_length=6)
Reviews = models.TextField()
Product_ID = models.ForeignKey(Product)

def _str_(self):
   return self.Name

class Seller(models.Model):
Seller_ID = models.IntegerField(unique=True)
Name = models.CharField(max_legth=264)
Contact = model.IntegerField()
Product_ID = models.ForeignKey(Product)

def _str_(self):
   return self.Name

class Order(models.Model):
Order_ID = models.IntegerField(unique=True)
DateOfDelivery = models.DateField(auto_now=False, auto_now_add=False)
Buyer_ID = models.ForeignKey(Buyer)
Product_ID = models.ForeignKey(Product)

def _str_(self):
   return self.Product.Name

class Admin(models.Model):
Admin_ID = models.IntegerField(unique=True)
Name = models.CharField(max_length=264)
Contact = models.IntegerField()
Product_ID = models.ForeignKey(Product)
Seller_ID = models.ForeignKey(Seller)
Buyer_ID = models.ForeignKey(Buyer)

def _str_(self):
   return self.Name

我得到的错误是:模块'django.db.models'没有属性'CharField'。 我已经检查了要导入的其他设置或文件,但一切都准备就绪

0 个答案:

没有答案