Peril
Peril

Reputation: 1599

adding to StringListProperty

i have the following

 class Image(db.Model):
    author = db.UserProperty()
    img = db.BlobProperty()
    rating = db.RatingProperty()
    tags = db.ListProperty() 

when the user upload an image , he will enter a list of tags by is choose sperating by comma so how can I store them in the database using the StringListProperty or ListProperty ??

Thanks

Upvotes: 1

Views: 172

Answers (1)

sahid
sahid

Reputation: 2610

I think you just need to split the string.

An example:

tags = self.request.get('tags').split(',')
img_ref.tags.extend(tags)
img_ref.put()

Upvotes: 1

Related Questions