just_a_dude
just_a_dude

Reputation: 2735

how to get the "id" property of an ndb.Model

I'm using Google App Engine for the first time and it's quite fun. I was able to set up my handlers, and start creating / reading models. The problem I'm facing is that I can't get the "id" field of the model:

m = MyModel.get_by_id(someId)
logging.debug(m.key)  // prints: Key('MyModel', 1) for example ... I want the '1'

Thanks in advance for your help

Upvotes: 1

Views: 194

Answers (1)

Lipis
Lipis

Reputation: 21835

You can get the id like this:

m.key.id()

Upvotes: 2

Related Questions