Take the 2-minute tour ×

I am looking for how to do validation on Google App Engine and I have found only how to do it using Django framework. Ok Django approach is ok but if I have one form and this form have data from few tables what then??? I can not do it like this:

class Item(db.Model):
    name = db.StringProperty()
    quantity = db.IntegerProperty(default=1)
    target_price = db.FloatProperty()
    priority = db.StringProperty(default='Medium',choices=[
      'High', 'Medium', 'Low'])
    entry_time = db.DateTimeProperty(auto_now_add=True)
    added_by = db.UserProperty()

class ItemForm(djangoforms.ModelForm):
    class Meta:
        model = Item
        exclude = ['added_by']

class MainPage(webapp.RequestHandler):
    def get(self):
                                '<form method="POST" '
        # This generates our shopping list form and writes it in the response
                                '<input type="submit">'
    def post(self):
        data = ItemForm(data=self.request.POST)
        if data.is_valid():
            # Save the data, and redirect to the view page
            entity = data.save(commit=False)
            entity.added_by = users.get_current_user()
            # Reprint the form
                                    '<form method="POST" '
                                    '<input type="submit">'

Is any easy way to validate form which contain data from few tables or I have to code it alone?

share|improve this question

2 Answers 2

Looks like you're using webapp; I suggest your look at some other 'light-weight' choices for form validation. Pick one that you like the layout / syntax of. You'll be able to define complex 'nested' relationships if needed.

share|improve this answer

WTForms has a GAE component WTForms

WTForms now includes support for AppEngine fields as well as auto-form generation. The form class can be used as it is or serve as a base for extended form classes, which can then mix non-model related fields, subforms with other model forms, among other possibilities.

share|improve this answer

Your Answer


