Advertisement
Guest User

Untitled

a guest
Sep 16th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. class User(db.Model): # Todo create a user model, that works with your login page
  2. username = db.UserProperty()
  3. password = db.StringProperty()
  4.  
  5. class BlogPost(ndb.Model):
  6. title = ndb.StringProperty()
  7. content = ndb.TextProperty()
  8. timestamp = ndb.DateTimeProperty(auto_add_now=True)
  9.  
  10. # Then you can specify a parent in the constructor (where user is a User entity)
  11. blog_post = BlogPost(parent=user)
  12. blog_post.title = 'Post title'
  13. blog_post.content = 'Post content'
  14. blog_post.put()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement