Added child_enpoints_model example.

As per https://github.com/GoogleCloudPlatform/endpoints-proto-datastore/issues/110#issuecomment-60832527 I have added the example for simple parent child relationship.
I can change that to MyParent. I *wanted* to make it as generic as
possible, to show later how it can be used in MyModel and reused in
MyModelFoo. Let me know if I should change it to MyParent. If so, then we
should probably slap the whole logic to MyModel then?

RE: self.parent_model_class seems to work for me here.

On Tue Oct 28 2014 at 6:46:02 PM Danny Hermes <notifications@github.com>
wrote:

> In examples/child_endpoints_model/main.py:
>
> > +    if self.key is not None:
> > +      # If there are not two tuples in the key pairs, a ValueError will occur.
> > +      parent_pair, id_pair = self.key.pairs()
> > +      # Each pair in key pairs will be a tuple (model kind, value) where model
> > +      # kind is a string representing the name of the model and value is the
> > +      # actual string or integer ID that was set.
> > +      self._parent = parent_pair[1]
> > +      self._id = id_pair[1]
> > +
> > +  # This is a setter which will be used by the alias property "parent". This
> > +  # method will be called when parent is set from a ProtoRPC request.
> > +  def ParentSet(self, value):
> > +    self._parent = value
> > +    # After setting the value, we must make sure the parent exists before it can
> > +    # be used as an ancestor.
> > +    if ndb.Key(self.__class__.parent_model_class, value).get() is None:
>
> This is overly generic for a sample, we should just use MyParent here. I
> don't expect many will know what __class__ is. Also note that
> self.parent_model_class will return a class variable.
>
> --
> Reply to this email directly or view it on GitHub
> <https://github.com/GoogleCloudPlatform/endpoints-proto-datastore/pull/112/files#r19516166>
> .
>