항목에 이미지가 포함되거나 댓글이없는 게시 시스템 모델을 설계하고 있습니다. 사용자는 설명이나 이미지 항목으로 회신 할 수 있습니다.App Engine 제안의 폴리 모델
ImageEntry에 대한 추가 속성이있을 수 있으므로 Polymodel에서이 디자인을 생각해 냈습니다. 이것이 최선의 방법인지 확실하지 않습니다. 스토리지 방식은 ImageEntry보다 적은 CommentEntry입니까?
어떤 제안이 좋을 것입니다.
class Entry(polymodel.PolyModel):
comment = db.TextProperty()
reply_to = db.SelfReferenceProperty() # reference to the entry
created_at = properties.DateTimeProperty(auto_now_add=True)
updated_at = properties.DateTimeProperty(auto_now=True)
class CommentEntry(Entry):
created_by = db.ReferenceProperty(User, collection_name='comment_entries')
class ImageEntry(Entry):
created_by = db.ReferenceProperty(User, collection_name='image_entries')
image_url = db.LinkProperty(indexed=False)
slug = db.StringProperty(indexed=False)
사실 ImageEntry에는 몇 가지 속성이 더 있습니다.하지만 Entry를 사용하는 것이 훨씬 간단합니다. 그 문제를 해결해 주셔서 감사합니다. – Dave