You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 12, 2024. It is now read-only.
Love the library, thanks for taking the time to build it!
I'm trying to figure out whether/how I could override default field types to enable HTML5 fields. For example, Email and PhoneNumber both default to calling get_TextField()
As a test, I did from wtform.fields import html5 as h5f
And override the functions like this:
def convert_EmailProperty(model, prop, kwargs):
"""Returns a form field for a db.EmailProperty."""
kwargs['validators'].append(validators.email())
return h5f.EmailField(**kwargs)
... and now my db.EmailProperty() field types show up as <input ... type="email" ... and db.PhoneNumberProperty() fields show up as <input ... type="tel" ...
But I'm wondering whether it'd be worth having a parameter passed in model_form() or as a field_arg to override the default type with a specific HTML5 input field type and do a logic check in these functions to look for that override switch, perhaps?
I'd be happy to get a pull request in if you think it's worthwhile.