Fun with Flask-WTForms, wtforms_appengine, and ndb Models

Running, Programming, Living

I’ve been playing around with Flask on Google App Enginein order to expand my current toolkit. I’ve been eyeballing the wtforms_appenginepackage but could not find a concrete exampleof how to use model_form to my advantage. This post outlines my findings.

First we will start off with a simple set of entities. Here we have two entities along with a mixin used for audit-related data. These entities are meant to model therelationship between Articles which each have their own Theme.

The idea here is that we want to display a form to create a new Article and we want to present the user with a drop down that is filled with meaningful labels. This is the (unstyled) end result we are going for:

I know, I know, it is ugly and provides generic html inputs textareas for URLs. That’s another post.

Here is the form that does the magic…

View original post 194 more words