开发者

How to replace app engine 'parent' field with Django functionality in django-nonrel?

I am looking at the challenges in converting a codebase from using app engine patch to using django-nonrel.

I have existing data where Visit has a parent entity of a Patient. So:

class Patient(db.Model):
  ...

class Visit(db.Model):
  ...

pat开发者_如何学Goient = Patient(...)
visit = Visit(parent=patient, ...)

How do I continue this relationship when using only django-nonrel code? For example, how do I create a new Visit when Patient and Visit are derived from django.db.models.Model? How do I query visits, specifying the parent Patient? And so on.

I'm willing to use backend-specific interfaces.


I may have found an answer: unsupported. Source says:

# 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!"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜