I'm using Google App Engine for my backend development and I'm using datastore models and Google Cloud Storage to store my image objects. So here's my Media model
class Media(ndb.Model):
url = ndb.StringProperty(indexed=False) # url generated by images.get_serving_url
path = ndb.StringProperty(indexed=False) # path in GCP
width = ndb.IntegerProperty(indexed=False)
height = ndb.IntegerProperty(indexed=False)
size = ndb.IntegerProperty()
created = ndb.DateTimeProperty(auto_now_add=True)
And now I also want to upload image thumbnail and store it in the same entity. So what I want is something like
class Media(ndb.Model):
...
thumnail = ndb.LocalStructuredProperty(Media)
But Python doesn't let me to use self class as an argument for class attribute and GAE doesn't allow model names as modelclass argument for ndb.StructuredProperty.
I'm wondering, is there any way to avoid this limitation like lazy initialization or something like that?
Media.thumnail = ndb.LocalStructuredProperty(Media)- Tim Hoffman