pyramid - SQLAlchemy / WTForms QuerySelectField -


i attempting use wtforms sqlalchemy extension on pyramid application.

i have done:

from wtforms import form, textfield,textareafield, validators wtforms.ext.sqlalchemy.fields import queryselectfield app.models import dbsession app.models import parentmodel   class newchild(form):     title = textfield('title:', [validators.required()])     intro = textareafield('introduction:')     body = textareafield('body:')     parent = queryselectfield(query_factory=dbsession().query(parentmodel).all) 

dbsession defined as

dbsession = scoped_session(sessionmaker(extension=zopetransactionextension())) 

the query seems work, display in template reading

<app.models.parentmodel object @ 0x9xxx> 

or such. doing wrong?

you need define a __str__ method on parentmodel


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -