How to simulate a lot of drops for an object?

I want to include something like a one-to-many relationship between a text object and blocks, so that the text object ("article" or similar) has many images and / or videos. There are two ways to figure out how to do this when the former uses the block list as an instance variable. Will this work?

class A(search.SearchableModel): blobs = db.ListProperty(blobstore.BlobReferenceProperty()) 

Advantages: Only one class. Readability and ease of obtaining and installing data. Disadvantages: Disadvantages of additional information for blobs, for example. if I want to mark blob with descriptive words, I still need two classes:

 class A(search.SearchableModel): ... class B(db.Model): reference=db.ReferenceProperty(A,collection_name='matched_blobs',verbose_name="Title") blob = blobstore.BlobReferenceProperty() 

A later example has a drawback because it requires a reference property and introduces 2 classes, where the problem can only be solved by class A, as in the first example. The advantage of the later solution is that it is clearly documented, and the listproperty of the blobreference properties is not a later solution that I have already implemented, and now I am thinking of using the blob list instead of the link. Does it matter or will it work equally well? Can you recommend which way to choose if one or the other?

thanks

0
python google-app-engine data-modeling blobstore
source share
1 answer

App Engine does have an article on this in their documentation: http://code.google.com/appengine/articles/modeling.html

+4
source share

All Articles