我正在Django中建立一个数据库。 models.py中星号*的正确字段类型是哪种? 我已经尝试了TextField,IntegerField和Charfield。
class Task(models.Model):
class Meta:
verbose_name_plural = 'Task'
save_date = models.DateTimeField(default=timezone.now())
hour_cr = models.TextField(default='*', validators=[MaxValueValidator(24), MinValueValidator(0)])
minute_cr = models.TextField(default='*', validators=[MaxValueValidator(59), MinValueValidator(0)])
day_of_the_month_cr = models.TextField(default='*', validators=[MaxValueValidator(31), MinValueValidator(0)])
month_cr = models.TextField(default='*', validators=[MaxValueValidator(12), MinValueValidator(1)])
day_of_week_cr = models.TextField(default='*', validators=[MaxValueValidator(7), MinValueValidator(1)])
name_task = models.TextField(max_length=25)
user = models.ForeignKey(User, on_delete=models.CASCADE)
AttributeError:模块'django.db.models'没有属性'CharacterData'
答案 0 :(得分:0)