示例#1
0
 def to_json(self):
     return {
         'id':
         self.id,
         'title':
         self.title,
         'body':
         self.body,
         'kind_id':
         self.kind_id,
         'kind':
         self.kind.to_json_simple() if self.kind else {},
         'timestamp':
         self.timestamp if self.timestamp is None else
         self.timestamp.strftime("%Y-%m-%d %H:%M:%S"),
         'user_id':
         self.user_id,
         'show':
         self.show,
         'user':
         self.user.to_json()
         if self.user is not None else AnonymousUser.to_json(),
         'img_url':
         self.img_url,
         'country_id':
         self.country_id,
     }
示例#2
0
文件: log.py 项目: IcyCC/BAIES
 def to_json_son(self):
     return {
         'id':self.id,
         'note': self.note,
         'user_id': self.user_id,
         'timestamp': self.timestamp if self.timestamp is None else self.timestamp.strftime("%Y-%m-%d %H:%M:%S"),
         'facts': [f.to_json() for f in self.facts],
         'table_id': self.table_id,
         'table': self.table.to_json_by_index(),
         'user': self.user.to_json() if self.user is not None else AnonymousUser.to_json()
     }
示例#3
0
文件: log.py 项目: IcyCC/BAIES
 def to_json_simple(self):
     return {
         'id':self.id,
         'note': self.note,
         'user_id': self.user_id,
         'timestamp': self.timestamp if self.timestamp is None else self.timestamp.strftime("%Y-%m-%d %H:%M:%S"),
         'table_id': self.table_id,
         'table': self.table.to_json_by_index(),
         'per_log_id': self.pre_log_id,
         'user': self.user.to_json() if self.user is not None else AnonymousUser.to_json()
     }