[英]django naturaltime returning the same result
In my model i have a fields like :
time = models.DateTimeField(auto_now_add=True)时间=models.DateTimeField(auto_now_add=True)
In view page i am getting the value like in this format :
2020-03-15T11:07:07.089Z 2020-03-15T11:07:07.089Z
I am getting the date time in this format.
{{ result.time|naturaltime }} {{ result.time|自然时间}}
but its not working it returning me the same date whick is comming from the data base但它不起作用它返回给我来自数据库的相同日期
You should use DateField
instead of DateTimeField
.您应该使用DateField
而不是DateTimeField
。 Like : time = models.DateField(auto_now_add=True)
here is a link for django fields(for more clarity) : https://docs.djangoproject.com/en/2.2/ref/models/fields/像: time = models.DateField(auto_now_add=True)
这里是 django 字段的链接(为了更清楚): https : time = models.DateField(auto_now_add=True)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.