Skip to content

Instantly share code, notes, and snippets.

@robert8138
Last active March 25, 2016 04:32
Show Gist options
  • Save robert8138/39fc25c02186a7b5ba26 to your computer and use it in GitHub Desktop.
Save robert8138/39fc25c02186a7b5ba26 to your computer and use it in GitHub Desktop.
@property
def serialize(self):
'''return as a json object so we can use it in RESTful API'''
return {'id': self.id,
'date': self.date.strftime("%Y-%m-%d"),
'duration': self.duration,
'event_type': self.event_type,
'event_name': self.event_name }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment