在 Django 模板中如何将日期和时间与 DateTimeField 分开?

In Django template how to separate Date and time from DateTimeField?

我只想在我的 Django 模板上打印日期。这是我的模型。

class Comment(models.Model):
    name = models.ForeignKey(User)
    body = models.TextField()
    pub_date = models.DateTimeField(auto_now_add=True)
    article  = models.ForeignKey(Article)

现在要在模板上打印日期和时间,我可以使用 {{object.pub_date}} 进行打印。 但我只想打印日期,而不是时间。 有没有办法在 Django 模板中这样做?

{{ object.pub_date|date:"D d M Y" }} {{ object.pub_date|time:"H:i" }}

所有选项解释:documentation