开发者

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 t开发者_运维百科he StringListProperty or ListProperty ??

Thanks


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()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜