How can I implement appengine data warehouse models?

in order to dynamically create a form, I need to find property types of model properties at run time.

appengine docs says Model.properties () will return a dictionary of property names and their class type. when I use this method in my code, only the name is returned and the classtype value is always empty.

+3
source share
1 answer

Model.kind()

For example, for such a model:

class LargeTextList(db.Model):
    large_text_list = db.ListProperty(item_type=db.Text)

my_model_instance.kind()returns LargeTextList.


Edit (thanks to OP for clarifying):
The property you are looking for is there, but you need to run away to see it, for example. in your template:

<p>{{ my_model_instance.properties|escape }}</p>

This returns:

{'large_text_list': <google.appengine.ext.db.ListProperty object at 0x24b1790>}

Edit2:
properties() :

my_model = LargeTextList

, ( escape):

<p>{{ model.properties|escape }}</p>
+1

Source: https://habr.com/ru/post/1747560/


All Articles