user2764108
user2764108

Reputation: 146

store the BlobKey in the model

I am wondering about what the best way of saving a blobstore reference The documented way would be like so:

blobstore.BlobReferenceProperty()

or

ndb.BlobKeyProperty()

or

db.StringProperty()

Are there any disadvantages to save a text string of the key?

Upvotes: 2

Views: 114

Answers (1)

Niklas Rosencrantz
Niklas Rosencrantz

Reputation: 26643

blobstore.BlobReferenceProperty That works in my apps and if you need an image class that can hold several images you can use something like

class Image(db.Model):

    reference = db.ReferenceProperty(Article,
            collection_name='matched_images', verbose_name='Title')
    primary_image = blobstore.BlobReferenceProperty()

Upvotes: 1

Related Questions