investigate django forms
The define form is written in jinja, and uses many custom macros and custom defined Field class. It also contains multi-row dataset. Initial investigation shows that this is a hard task, and may take more than a week to finish. However, it is still worth looking because the current approach has maintainability issues.
(by ztatum)