google-app-engine - 使用 Google App Engine 创建引用自身的模型

标签 google-app-engine model

我尝试了以下操作

class SomeModel(db.Model):
    prev = db.ReferenceProperty(SomeModel)
    next = db.ReferenceProperty(SomeModel)

但出现如下错误

NameError: name 'TrackPointModel' is not defined

有没有办法做到这一点?

最佳答案

是的,您可以使用 SelfReferenceProperty

class SomeModel(db.Model):
    prev = db.SelfReferenceProperty()
    next = db.SelfReferenceProperty()

关于google-app-engine - 使用 Google App Engine 创建引用自身的模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3119947/

相关文章:

forms - 我如何在 ionic 2 中将数据从带有表单的模态传递到主页?

python - 以编程方式在 Google 应用引擎上设置子域

google-app-engine - App Engine 运行 go 1.5,发行说明说 1.6

google-app-engine - 为什么在 IntelliJ 中升级 App Engine SDK 如此痛苦?

tensorflow - 属性错误 : The layer has never been called and thus has no defined output shape

ruby-on-rails - 在模型内访问时使用 attribute_name 还是 self.attribute_name 是更好的做法

python - 无法导入ndb

php - 在谷歌应用引擎的laravel coaster cms中使特定文件夹可写

php - CakePHP 约定名称或连接的名称

c++ - 使用自定义 QSortFilterProxyModel 覆盖哪些函数