這是你想要的嗎?
代碼:
from google.appengine.ext import db
class Field(db.Model):
author = db.StringProperty()
content = db.StringProperty(multiline=True)
date = db.DateTimeProperty(auto_now_add=True)
a = Field(author="me")
a.put()
編輯:
field = Field.all()
for f in field:
print f.author
print f.content
props = Field.properties()
print props
for vals in props:
print vals
輸出:
<__main__.Field object at 0xb8c9e4c>
{'content': <google.appengine.ext.db.StringProperty object at 0xb7c0aec>, 'date': <google.appengine.ext.db.DateTimeProperty object at 0xb7c06cc>, 'author': <google.appengine.ext.db.StringProperty object at 0xb7c0f6c>}
content
date
author
您是否嘗試過打印''names''和''field.keys()'' - 因爲可能錯誤是有效的。 – sotapme 2013-02-24 17:14:10
@sotapme名稱打印正確。使用Get – Saqib 2013-02-25 04:23:59