mrjoes/flask-admin — pull request #33 by redouane (2012-07-05 15:52:16+00:00)
Title: fixed problem with wtf.FileField not getting updated with request.files data upon instantiation of Form

this fixes an issue with flask-wtf FileField not getting filled with request.files data
basically, if you pass request.form to a Form() class, it will fill itself with request.form data only and forgets about request.files
if you ommit the request.form altogether, flask-wtf fills the form with both, request.form, and request.files data
so if you have a FileField called image, you can access the werkzeug filestorage with a simple
form.image.data

here's the code bit that does just that.
https://github.com/rduplain/flask-wtf/blob/master/flask_wtf/form.py#L50

ofcourse this is not necessary, and everyone can override and implement custom behavior, but it would be nice to have my form.image.data filled and not empty by default.
use case:
when using form_overrides with a wtf.FileField
i can access form.image.data inside create_model directly without having to get that from request.files.
thanks.