Django TimeField Model without seconds

前端 未结 7 2154
青春惊慌失措
青春惊慌失措 2021-02-08 12:48

Greetings, I am trying to implement a TimeField model which only consists of HH:MM (ie 16:46) format, I know it is possible to format a regular Python time object but I am lost

7条回答
  •  情话喂你
    2021-02-08 13:32

    On Django 1.9 the following format should work:

    {{ yourData.value|time:"H:i" }}
    

    Django has a whole set of template tags and filters.

    Django 1.9 documentation on this is:

    https://docs.djangoproject.com/en/1.9/ref/templates/builtins/#time

提交回复
热议问题