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, }
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() }
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() }