GAE: db Model property using 'name' param

为君一笑 提交于 2019-12-13 04:06:41

问题


Trying to optimise db model class property name by using name in the property.

Ex.

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='{}')

Query on terminals:

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

putting happening fine into db. but while i try serialize this query object.

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

its raising the error as,

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

Could any one tell this, where went wrong here?

Regards.

来源:https://stackoverflow.com/questions/12870637/gae-db-model-property-using-name-param

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!