This is a fork of the Wtforms form handling library to support keyword arguments together with form submission.


Wtforms approach is to ignore keyword args when form submission is given. Keyword args are often used as default arguments that should be overridden with actual submission values. Un-checked checkbox fields in the HTML are especially tricky with this, since they will be missing from the form submission and thus default values will always override them.

I have another use case and that is augmenting form with data when the purpose is to return the form with both the added data and the submission. With complex forms, having hundreds of fields many of them compound type and going many levels deep, there is need to add data to the form. Fieldlist can facilitate this with append_entry, but with more subfields one would need to set each attribute separately.

I believe this is a valid use case. Form instantiations can have default arguments with the combination of form submission. When used responsibly one can add data to the form when taking care of possible clashes with the checkbox fields and the like.


This fork is only a simple change. It still does not allow to add new content deep inside listfields, eg. listform = ListTestForm(MultiValueDict({"profiles-0-birthday": ["2010-01-01"]}), **{"profiles": [{"signature":"content"}, {"signature":"more content"}]})

Current functionality ignores the second profiles list's value. When adding content many levels deep, the only approach is to navigate the form using a form of introspection to locate the correct attribute and call its append_form method.

This fork brakes Wtforms' current API. Other possible change would be to add a distinct insert_data method to the form which would take the date dictionary as argument and insert it in the form values as the instantiation does. This would not brake the current Wtform functionality and add support for my use case. I have no notion how to do this at this time...