From 7f77caf6bfaf960e236c573c8da16eee809f0ebc Mon Sep 17 00:00:00 2001 From: Brian Wood <legion.the.unforgiven@gmail.com> Date: Sat, 19 Apr 2014 20:08:22 -0600 Subject: [PATCH] Updated User and Movie --- project/model/Movie.py | 6 +++++- project/model/User.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/project/model/Movie.py b/project/model/Movie.py index f534559..c6e0a1a 100644 --- a/project/model/Movie.py +++ b/project/model/Movie.py @@ -21,4 +21,8 @@ class Movie(db.Document): return self.title def __repr__(self): - return {'created': self.created, 'title': self.title, 'summary': self.summary, 'tags': str(self.tags), 'id':str(self.id)} + return str(self.toJSON()) + + def toJSON(self): + import json + return json.dumps({'created': self.created.isoformat(), 'title': self.title, 'summary': self.summary, 'tags': str(self.tags), 'id':str(self.id)}) \ No newline at end of file diff --git a/project/model/User.py b/project/model/User.py index 3754203..ff1d3d0 100644 --- a/project/model/User.py +++ b/project/model/User.py @@ -49,7 +49,11 @@ class User(db.Document): return self.email def __repr__(self): - return {'created': self.created, 'email': self.email, 'roles': self.roles, 'id':str(self.id)} + return str(self.toJSON()) + + def toJSON(self): + import json + return json.dumps({'created': self.created.isoformat(), 'email': self.email, 'roles': self.roles, 'id':str(self.id)}) meta = { 'allow_inheritance': True, -- GitLab