O'Reilly logo

Mastering Google App Engine by Mohsin Shafique Hijazee

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The model

We have been using ndb.Model so far, but didn't look at the class in detail. The following are the three groups of things that we need to look into:

  • The constructor
  • The class methods
  • The instance methods

Let's look at these in turn.

The constructor

We have been using constructor throughout our examples, as follows:

Listing(title="Civic 1995 for Sale")

What can you pass to the constructor? Basically, all the properties that you declared on the model itself can be supplied as keyword arguments for initial values while creating the instance. Besides this, the following can be supplied:

  • ID: This is either an integer or a string that you wish to use as an identifier instead of the autogenerated one using the id keyword argument. If an ID is provided, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required