Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flask html5 DateTimeField with picker

Tags:

python

html

flask

I have a very simple form, with 2 fields (one DateTime and one Date). I am trying to get them to render with a picker for each.

from flask.ext.wtf import Form
import wtforms as wtf
import wtforms.fields.html5 as html5
class CaseForm(Form): 
   foo = html5.DateTimeField("Date Time Sample")
   bar = html5.DateField("Date Time Sample")

The field foo does not render with a picker widget, but bar does. I can see from the code for the html5 fields that there is a widget associated with the DateTimeField.

Any ideas on how to render a picker for DateTime fields

like image 754
Steven Bade Avatar asked Nov 21 '22 17:11

Steven Bade


1 Answers

I had the same problem,after much frustration I ended up using DateTimeLocalField.

like image 50
user6855334 Avatar answered Jan 03 '23 03:01

user6855334