Commits

Atsushi Odagiri committed 5eb97a7

fix wtforms

Comments (0)

Files changed (2)

wtforms/pyconjp2011/wtforms_demo/__init__.py

 from sqlalchemy import engine_from_config
 from mako.lookup import TemplateLookup
 import wtforms
+from wtforms.ext.sqlalchemy.fields import QuerySelectMultipleField
 
 from .. import models
 
     username = wtforms.TextField('User Name')
     password = wtforms.PasswordField('Password')
     user_image = wtforms.FileField('User Image')
+    groups = QuerySelectMultipleField(query_factory=lambda: models.DBSession.query(models.Group))
 
 @wsgify
 def index(request):

wtforms/pyconjp2011/wtforms_demo/templates/index.mak

 ${self.field_row(form.username)}
 ${self.field_row(form.password)}
 ${self.field_row(form.user_image)}
+${self.field_row(form.groups)}
 </table>
 </body>
 </html>