【发布时间】:2021-08-29 23:37:22
【问题描述】:
我想今天创建设备 这是我的模型:
class Device(models.Model):
hostname = models.CharField(max_length=200, null=True)
password = models.CharField(max_length=200, null=True)
type = models.CharField(max_length=200,choices=dtype, null=True)
ipadress = models.CharField(max_length=200, null=True)
date_created = models.DateTimeField(auto_now_add=True, null=True)
我尝试了这些观点,但没有奏效:
device_today = Device.objects.filter(date_created=today).count()
有什么建议吗?
【问题讨论】:
标签: django database django-models django-templates aggregate