NDB Application Kernel: How to Access the verbose_name Property

Suppose I have this code:

class A(ndb.Model):
    prop = ndb.StringProperty(verbose_name="Something")

m = A()
m.prop = "a string value"

Now, of course, if I type m.prop, it will output a "string value", while in reality it is an instance of StringProperty. Thus, verbose_name cannot have access to the "normal" path, i.e. m.prop._verbose_name.
I read the code and found a way to access it: m._properties["prop"]._verbose_nameit works, but it looks hacked o_o.
So tell me, is there any other way to do this?
Note. I'm talking about the NDB API, not the old one.

+5
source share
1 answer

Use the class: attribute A.prop._verbose_name. Or m.__class__.prop._verbose_name.

+7

All Articles