Invalidating postdata

28 Mar

Though they are a less headline-grabbing feature of Siesta, these request hooks are quite robust. when showing a spinner for a manually initiated refresh.If there is no POST data, or the data fails to validate, then the view “falls through” to the rendering portion.The Form object can be passed into the template and its attributes can be used to render the fields and also for displaying errors: So there we have a full simple “edit object” page setup which illustrates a best-practice way of using WTForms.

invalidating postdata-59invalidating postdata-80

The reason we redirect after the post is a best-practice associated with the Post/Redirect/Get design pattern.Dict-style access on a Base Form instance will allow you to access (and modify) the enclosed fields.Because Base Form does not require field names to be valid identifiers, they can be most any python string.The Form would have fields describing the fields to be updated and the validation rules, where the attribute names of the fields match those of the attribute names on the object.The second parameter to the Form, the Note While we did pass an object as the data source, this object data is only used if there is no POST data.