Skip to content

Instantly share code, notes, and snippets.

@sheki
Created October 8, 2011 17:30
Show Gist options
  • Select an option

  • Save sheki/1272591 to your computer and use it in GitHub Desktop.

Select an option

Save sheki/1272591 to your computer and use it in GitHub Desktop.
from flaskext import wtf
from flaskext.wtf import validators
class PostForm(wtf.Form):
self.languages = ['Java','Python','C','C++','Perl','HTML']
langTuples = [ (str(i) ,self.languages[i])for i in range(0,len(self.languages)) ]
name = wtf.TextField('name', validators=[validators.Required()],)
code = wtf.TextAreaField('code', validators=[validators.Required()])
lang = wtf.SelectField('language',choices=langTuples)
def getLangByNo(self, no):
return self.languages[int(no)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment