In storing data into an NDB, I'd like to obtain the name of the field from a string variable (e.g., field_name2 = "userid"). Is there a way? thanks in advance.
class Account(ndb.Model):
username = ndb.StringProperty()
userid = ndb.IntegerProperty()
class MainPage():
field_name2 = 'userid'
acct = Account.get_key(id).get()
acct.username = "Bob"
acct[**field_name2**] = "001" ## How can I do something like this?
acct.put()