GAE Python:建模的建议

时间:2012-06-07 07:15:20

标签: python google-app-engine

Stackoverflowers成员

我有一个问题,因为我不是数据库英雄。我有以下型号:

class Hardware(db.Model):
    title        = db.StringProperty()
    description  = db.TextProperty()
    visible      = db.BooleanProperty()
    reservations = db.ListProperty(db.Key)

class Reservation(db.Model):
    between      = db.DateProperty()
    until        = db.DateProperty()
    user         = db.UserProperty()
    item         = db.ReferenceProperty()
    active       = db.BooleanProperty()
    archive      = db.BooleanProperty()

class UserData(db.Model):
    user         = db.UserProperty()
    nickname     = db.StringProperty()
    admin        = db.BooleanProperty()
    locked       = db.BooleanProperty()

在稍后阶段,我想看看用户做出了哪些预订。为此我想在预约模型中有另一个ReferenceProperty。但我不能。我收到错误

DuplicatePropertyError: Class Model already has property reservation_set 

我不能再使用UserProperty了,因为我需要为其他用户预订,然后我的。

建议?

1 个答案:

答案 0 :(得分:2)

尝试为每个ReferenceProperty提供唯一的collection_name Docs