Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class User(db.Model): # Todo create a user model, that works with your login page
- username = db.UserProperty()
- password = db.StringProperty()
- class BlogPost(ndb.Model):
- title = ndb.StringProperty()
- content = ndb.TextProperty()
- timestamp = ndb.DateTimeProperty(auto_add_now=True)
- # Then you can specify a parent in the constructor (where user is a User entity)
- blog_post = BlogPost(parent=user)
- blog_post.title = 'Post title'
- blog_post.content = 'Post content'
- blog_post.put()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement