Using Formfields and Fieldlists with WTForms submits a dictionary of items with the form submit.
Here's an example:
data = {
... "stepset-0-recipe_step_id": "5",
... "stepset-0-recipe_step_name": "boil rice",
... "stepset-0-recipe_step_temp": "42.0",
... "stepset-1-recipe_step_id": "6",
... "stepset-1-recipe_step_name": "heat rice",
... "stepset-1-recipe_step_temp": "57.0",
}
I get that I need to parse through this but I'm struggling a bit with the data structure.
Every 3 lines need to be added to an entry in the database. So how do I go about doing this?
I'm currently looking into regex to grab the number in the key, and the 'recipe_step_id' etc to match the values in the database row.
The other question is, I'm assuming that the id is important to have here as the Fieldlist doesn't seem to submit a database object, am I correct? Do I need to hide this field somehow (I don't want users to be able to edit or see it really).