GAE:db Model属性使用' name' PARAM

时间:2012-10-13 06:36:29

标签: django google-app-engine django-models google-cloud-datastore

尝试使用属性中的name来优化数据库模型类属性名称。

实施例

class terminals(db.Model):
   location_code = db.StringProperty()
   terminal_code = db.StringProperty(default='')
   start_invoice_no = db.IntegerProperty(indexed=False, default=1, name='sin')
   next_invoice_no = db.IntegerProperty(indexed=False)
   last_doc_details = db.TextProperty(default='{}')

终端查询:

terminal_qry = db.Model(terminals).all()

将正常情况发送到db。但是当我尝试序列化这个查询对象时。

serializers.serialize('json', [terminal_qry])

将错误提高为,

AttributeError: 'terminals' object has no attribute 'sin'

有没有人能说出来,这里出了什么问题?

问候。

0 个答案:

没有答案