In fact that code I wrote doesn't work because in the SDK the
collection_names are instances of db._ReverseReferenceProperty, not
db.Query.

Since "_ReverseReferenceProperty" starts with "_", it's not safe to assume
that the collection_names will continue to be instances of
db._ReverseReferenceProperty, correct?

Has anyone done something similar that works and is safe to use?


On 19 February 2010 14:33, Nickolas Daskalou <[email protected]> wrote:

> Say I have these Models:
>
> class Model1(db.Model):
>   ....
>
> class Model2(db.Model):
>   model1 = db.ReferenceProperty(Model1, collection_name = 'model2s')
>   ....
>
> class Model3(db.Model):
>   model1 = db.ReferenceProperty(Model1, collection_name = 'model3s')
>   ....
>
> Would this be the best way to get all of Model1's collection_names?
>
> collection_names = [name for name in dir(Model1) if
> isinstance(getattr(Model1,name), db.Query)]
>
> Is there a better way?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to