Esempio n. 1
0
 def getDetail(self):
     """Returns base info"""
     return {
         'date_started': my_strftime(self.date_started),
         'date_ended': my_strftime(self.date_ended),
         'timestamp': my_strftime(self.time_added),
         'user': self.user.getInfo()
     }
Esempio n. 2
0
 def getDetail(self):
     """Returns dictionary object containing the info of this object"""
     return {
         'author': self.user.getInfo(),
         'timestamp': my_strftime(self.time_sent),
         'text': self.text
     }
Esempio n. 3
0
 def getDetail(self):
     """Returns dictionary object containing basic info"""
     return {
         'id': self.id,
         'user_1': self.user_1.get_profile().getInfo(),
         'user_2': self.user_2.get_profile().getInfo(),
         'relationship_type': self.get_relationship_type_display(),
         'type': 'relationship',
         'timestamp': helper_functions.my_strftime(self.timestamp)
     }
Esempio n. 4
0
 def getDetail(self):
     """Returns dictionary object containing detail about this comment"""
     return { 'author' : self.author.getInfo(), 'text' : self.text, 'votes' : self.votes,
             'timestamp' : my_strftime(self.time_created), 'type' : 'comment',
             'relative_timestamp' : relative_timestamp(self.time_created) }
Esempio n. 5
0
 def getDetail(self):
     """Returns dictionary object with basic info"""
     return { 'author' : self.author.getInfo(), 'recipient' : self.recipient.getInfo(), 'text' : self.text,
             'timestamp' : my_strftime(self.time_posted), 'type' : 'post', 'id' : self.id, 
             'num_comments' : len(self.comment_set.all()), 'relative_timestamp' : relative_timestamp(self.time_posted), 'score' : self.getScore() }
Esempio n. 6
0
 def getDetail(self):
     """Returns dictionary object containing the info of this object"""
     return { 'author' : self.user.getInfo(),
             'timestamp' : my_strftime(self.time_sent),
             'text' : self.text }
Esempio n. 7
0
 def getDetail(self):
     """Returns base info"""
     return { 'date_started' : my_strftime(self.date_started),
             'date_ended' : my_strftime(self.date_ended),
             'timestamp' : my_strftime(self.time_added), 'user' : self.user.getInfo() }
Esempio n. 8
0
 def getDetail(self):
     """Returns dictionary object containing basic info"""
     return { 'id' : self.id, 'user_1' : self.user_1.get_profile().getInfo(), 'user_2' : self.user_2.get_profile().getInfo(),
             'relationship_type' : self.get_relationship_type_display(), 'type' : 'relationship', 
             'timestamp' : helper_functions.my_strftime(self.timestamp) }
Esempio n. 9
0
 def getDetail(self):
     """Returns dictionary object containing info about this post"""
     return { 'author' : self.author.getInfo(), 'text' : self.text, 'score' : self.score,
             'timestamp' : my_strftime(self.time_posted) }
Esempio n. 10
0
 def getDetail(self):
     return { 'author' : self.author.getInfo(), 'text' : self.text,
             'timestamp' : my_strftime(self.time_created), 'type' : 'comment',
             'relative_timestamp' : relative_timestamp(self.time_created) }
Esempio n. 11
0
    def getDetail(self, user=None):
        """
        Returns dictionary object containing info about this event
        Optionally, relative to a logged-in user
        """
        if user is not None:
            user_attending = 1 if user in self.userprofile_set.all() else 0
        else:
            user_attending = 0

        #Get event picture
        if self.image is not None:
            event_image = self.image.handle
        else:
            event_image = 'default_event.jpg'

        #Build attending list
        attending_list = [ u.getInfo() for u in self.userprofile_set.all() ]

        return { 'author' : self.author.getInfo(), 'title' : self.event_title, 'description' : self.description, 
                'num_attending' : len(self.userprofile_set.all()), 'attending' : attending_list, 'timestamp' : my_strftime(self.time_created),
                'type' : 'event', 'score' : self.getScore(), 'duration' : self.duration, 
                'user_attending' : user_attending, 'relative_timestamp' :  relative_timestamp(self.time_created), 'id' : self.id,
                'location' : self.location, 'picture' : event_image, 'thumbnail' : 'Thumbnails/' + event_image }