我正在Django中从事一个项目。我想扩展用户模型类以添加一些自定义字段。我为基本用户类和扩展用户类创建了单独的表单。 这是我的延伸班
class User(models.Model):
user = models.OneToOneField(AuthUser, on_delete=models.CASCADE)
date_of_birth = models.DateField()
gender = models.CharField(max_length=2, choices=[(tag.name, tag.value) for tag in Gender], default=Gender.M)
address = models.CharField(max_length=200)
city = models.CharField(max_length=10)
state = models.CharField(max_length=10)
contact = models.CharField(max_length=12)
photo = models.ImageField()
category = models.CharField(max_length=10, choices=[(tag.name, tag.value) for tag in Category],
default=Category.GEN)
blood_group = models.CharField(max_length=10, choices=[(tag.name, tag.value) for tag in BloodGroup],
default=BloodGroup.ABP, blank=True)
type = models.CharField(max_length=10, choices=[(tag.name, tag.value) for tag in UserType], default=UserType.U)
但是当我接受输入时,它给我一个错误,如图所示 Screentshot of error