简体   繁体   中英

how to get all the datastore results just with a key?

I am pretty new to Python and GAE. Busy building a simple blog to learn. Was wondering, how can I get the datastore entries?

This is how my DB object looks like :

class BlogArticles(db.Model):
    author = db.UserProperty()
    article_name = db.StringProperty()
    article = db.TextProperty()
    date = db.DateTimeProperty(auto_now_add=True)

Can I get say author and article from passing the key to something like

db.get(key_value)

aah figured it out :)

Here is how I did it...so simple.

    all_data = db.get(edit_article)
    article_name = all_data.article_name
    article = all_data.article

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM