Django TimeField Model without seconds

前端 未结 7 2156
青春惊慌失措
青春惊慌失措 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:37

    Django widget can be used to achieve this easily.

    from django import forms
    
    class timeSlotForm(forms.Form):
        from_time = forms.TimeField(widget=forms.TimeInput(format='%H:%M'))
    
    0 讨论(0)
提交回复
热议问题