Adding a user supplied property (at runtime) to an instance of Expando class in Google App Engine?

前端 未结 2 2017
孤城傲影
孤城傲影 2021-01-28 10:37

By creating datastore models that inherit from the Expando class I can make my model-entities/instances have dynamic properties. That is great! But what I want is the names of t

2条回答
  •  时光说笑
    2021-01-28 11:02

    Just found the solution to my own question. It was really simple but as I am a python noob I ended up posting the question that you see above.

    For the code sample that I had used, this is what needs to be done:

    entity_two.__setattr(some_variable, some_value) #where some_variable is populated by user at runtime :)
    

提交回复
热议问题