<div id="div_id_time_field" class="field-wrapper mb-3">
<label for="id_time_field" class="label-class block text-gray-900 text-sm mb-2">
Time field<span class="asteriskField">*</span>
</label>
<div>
<input
data-controller="flatpickr"
data-flatpickr-enable-time="true"
data-flatpickr-no-calendar="true"
type="text"
name="time_field"
value="06:08:21"
data-flatpickr-enable-seconds="false" class=" bg-white focus:outline-none border border-gray-300 rounded-lg py-2 px-4 block w-full appearance-none leading-normal text-gray-700" required id="id_time_field"
>
</div>
</div>
def pick_time(self, **kwargs):
class TestForm(forms.Form):
time_field = forms.TimeField(
initial=timezone.now,
widget=HammerTimeWidget(
attrs={
"data-flatpickr-enable-seconds": "false",
},
),
)
form = TestForm()
template = Template(
"""
{% load formify %}
{% render_field form.time_field %}
""",
)
return template.render(Context({"form": form}))