【发布时间】:2013-11-15 16:21:06
【问题描述】:
我正在使用 Google Appengine 和 Python 学习 Udacity 的 Web 开发课程。
我想知道如何分配给创建的实体,它自己的作者。
例如,我有两种 ndb.Models:
class User(ndb.Model):
username = ndb.StringProperty(required = True)
bio = ndb.TextProperty(required = True)
password = ndb.StringProperty(required = True)
email = ndb.StringProperty()
created = ndb.DateTimeProperty(auto_now_add = True)
class Blog(ndb.Model):
title = ndb.StringProperty(required = True)
body = ndb.TextProperty(required = True)
created = ndb.DateTimeProperty(auto_now_add = True)
Blog 实体由登录用户创建时,它自己的作者(User 实体)也应该用它来标识。
最后,我想显示博客文章及其作者信息(例如,作者的简历)
如何做到这一点?
【问题讨论】:
标签: python google-app-engine google-cloud-datastore app-engine-ndb