【问题标题】:How to replace app engine 'parent' field with Django functionality in django-nonrel?如何在 django-nonrel 中用 Django 功能替换应用引擎“父”字段?
【发布时间】:2011-09-18 21:33:43
【问题描述】:

我正在研究将代码库从使用 app engine patch 转换为使用 django-nonrel 的挑战。

我有现有数据,其中 Visit 有一个患者的 parent entity。所以:

class Patient(db.Model):
  ...

class Visit(db.Model):
  ...

patient = Patient(...)
visit = Visit(parent=patient, ...)

仅使用 django-nonrel 代码时如何继续这种关系?例如,当 Patient 和 Visit 派生自 django.db.models.Model 时,如何创建新的 Visit?如何查询访问,指定父患者?以此类推。

我愿意使用后端专用接口。

【问题讨论】:

    标签: google-app-engine django-nonrel


    【解决方案1】:

    我可能找到了答案:不支持。 Source 说:

    # for now we do not support KeyFields thus a Key has to be the own
    # primary key
    # TODO: GAE: support parents via GAEKeyField
    assert value.parent() is None, "Parents are not yet supported!"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-12-10
      • 1970-01-01
      • 2011-07-06
      • 1970-01-01
      • 2015-11-05
      • 2011-08-06
      • 2017-10-23
      相关资源
      最近更新 更多