本文整理匯總了Python中utility.utility.Utility.get_instance_fields方法的典型用法代碼示例。如果您正苦於以下問題:Python Utility.get_instance_fields方法的具體用法?Python Utility.get_instance_fields怎麽用?Python Utility.get_instance_fields使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類utility.utility.Utility
的用法示例。
在下文中一共展示了Utility.get_instance_fields方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: to_json
# 需要導入模塊: from utility.utility import Utility [as 別名]
# 或者: from utility.utility.Utility import get_instance_fields [as 別名]
def to_json(self, all_fields=False):
json_object = dict(
_id=self._id,
_rev=self._rev,
name=self.name,
created=Utility.format_datetime(self.created),
modified=Utility.format_datetime(self.modified),
created_by=Utility.get_instance_fields(self.created_by, ['_id', 'username']),
modified_by=Utility.get_instance_fields(self.modified_by, ['_id', 'username'])
)
if all_fields:
json_object.update(dict())
return json_object
示例2: to_json
# 需要導入模塊: from utility.utility import Utility [as 別名]
# 或者: from utility.utility.Utility import get_instance_fields [as 別名]
def to_json(self, all_fields=False):
json_object = dict(
_id=self._id,
_rev=self._rev,
message_body=self.message_body,
destination=self.destination,
status=self.status,
type=self.type,
source=self.source,
created=Utility.format_datetime(self.created),
modified=Utility.format_datetime(self.modified),
created_by=Utility.get_instance_fields(self.created_by, ['_id', 'username']),
modified_by=Utility.get_instance_fields(self.modified_by, ['_id', 'username'])
)
if all_fields:
json_object.update(dict())
return json_object