Exemplo n.º 1
0
 def as_dict(self):
     d = {c.name: convert_to_string(getattr(self, c.name)) for c in self.__table__.columns}
     # author details
     au = self.author
     au.fetch_relationship_detail(User.query.get(self.user_id))
     d['author'] = au.as_dict()
     # picture details
     pic = self.picture_contents
     d['picture_contents'] = [i.as_dict() for i in pic]
     # liked by
     d['likes'] = [i.as_dict() for i in self.users_who_liked_this]
     return d
Exemplo n.º 2
0
 def as_dict(self):
     d = {
         c.name: convert_to_string(getattr(self, c.name))
         for c in self.__table__.columns
     }
     # author details
     au = self.author
     au.fetch_relationship_detail(User.query.get(self.user_id))
     d['author'] = au.as_dict()
     # picture details
     pic = self.picture_contents
     d['picture_contents'] = [i.as_dict() for i in pic]
     # liked by
     d['likes'] = [i.as_dict() for i in self.users_who_liked_this]
     return d
Exemplo n.º 3
0
 def as_dict(self):
     return {c.name: convert_to_string(getattr(self, c.name)) for c in self.__table__.columns}
Exemplo n.º 4
0
 def as_dict(self):
     return {
         c.name: convert_to_string(getattr(self, c.name))
         for c in self.__table__.columns
     }