开发者

Google App Engine getting verbose_name of a property from an instance

Given a model like so:

 from google.appengine.ext import db
 class X(db.Model):
    p = db.StringProperty(verbose_name="Like π, but more modern.")

How does one access verbose_name from x=X() (an instance of X)?

One might expect that x.p.verbose_name would work, or alternatively x.properties()['p'].verbose_name, but neither seems to work.

Thanks!

EDIT: x.name.ve开发者_如何学运维rbose_name => x.p.verbose_name


x.properties()['p'].verbose_name definitely works - you can verify for yourself on http://shell.appspot.com/


x = X(p="Foo!")
print x.p.verbose_name

Does that work?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜