<div id="div_id_date_field" class="field-wrapper mb-3">
<label for="id_date_field" class="label-class block text-gray-900 text-sm mb-2">
Date field<span class="asteriskField">*</span>
</label>
<div>
<input
data-controller="flatpickr"
data-flatpickr-enable-time="false"
type="text"
name="date_field"
value="2024-11-21"
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_date_field"
>
</div>
</div>
def pick_date(self, **kwargs):
class TestForm(forms.Form):
date_field = forms.DateField(initial=timezone.now, widget=HammerDateWidget)
form = TestForm()
template = Template(
"""
{% load formify %}
{% render_field form.date_field %}
""",
)
return template.render(Context({"form": form}))