model - Polymodel on App Engine suggestion -


i'm designing model posting system entry contains image or without comment. user can reply either comment or image entry well.

as there can more properties imageentry, came design polymodel. not sure if best way this. storage-wise, commententry less imageentry?

any suggestions great.

class entry(polymodel.polymodel):   comment    = db.textproperty()   reply_to   = db.selfreferenceproperty() # reference 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) 

this model work fine, , yes, commententry smaller imageentry same user if imageentry has image url and/or slug.

however, i'd make simpler putting created_by, image_url, , slug entry , getting rid of commententry , imageentry altogether. since the app engine datastore schemaless, , properties optional default, you'll pay cost of image_url , slug properties when fill them in image entries.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -