[Flask] Can I write my own WTF file validator?
jicenhower at yahoo.com
Mon Oct 19 15:00:21 CEST 2015
Hi,I'm creating an import using Flask, WTF and Flask Appbuilder. I see that the Flask WTF FileField allows validators. Can I create my own? I want to check that required fields are populated on every record in the uploaded file. I'd like to pass a class to the validator that contains the required fields so I can use this routine for many different record types.I think I'd like to do something like this:class UploadForm(Form):
upload = FileField("Upload your Events file",
file_required_fields(Events, "Images only!")])Is this possible? If so, what class to I extend/inherit from to create my validator? I'm a Java developer but a total newbie to Python/Flask.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Flask