Esempio n. 1
0
 def serialize(self):
     """
     Return this object data into an easily serializable form (For JSON)
     """
     from action.like import get_total_likes_checkpoint
     from action.comment import get_checkpoint_comments
     from action.user import get_user
     
     return {
             "id": self.id,
             "creator": self.creator,
             "creator_name": get_user(self.creator).facebook_user.name,
             "name": self.name,
             "description": self.description,
             "price": self.price,
             "expiry": serialize_json_datetime(self.expiry),
             "date_created": serialize_json_datetime(self.date_created),
             "type": self.type,
             "image": self.image,
             "image_url": get_checkpoint_img_url(self),
             "longitude": self.longitude,
             "latitude": self.latitude,
             
             "total_likes": get_total_likes_checkpoint(self),
             "total_comments": get_checkpoint_comments(self).count(),
             }
Esempio n. 2
0
 def serialize(self):
     """
     Return this object data into an easily serializable form (For JSON)
     """
     return {"id": self.id,
             "user_id": self.user_id,
             "comment": self.comment,
             "timestamp": serialize_json_datetime(self.timestamp),
             "checkpoint_id": self.checkpoint_id,
             "facebook_profile_pic_url": "https://graph.facebook.com/%s/picture" % self.user.facebook_user.id,
             "name": self.user.facebook_user.name,
             }
Esempio n. 3
0
 def serialize(self):
     """
     Return this object data into an easily serializable form (For JSON)
     """
     return {
             "id": self.id,
             "type": self.type,
             "relevant_id": self.relevant_id,
             "timestamp": serialize_json_datetime(self.timestamp),
             
             #usable stuff
             "meta": describe_notification(self)
             }