summaryrefslogtreecommitdiff
path: root/models
diff options
context:
space:
mode:
authorMichaël Ball <michael.ball@gmail.com>2017-06-17 09:57:39 +0100
committerMichaël Ball <michael.ball@gmail.com>2017-06-17 09:57:39 +0100
commitda5c7e73112db917f2fb0c91635c48954cc3648e (patch)
tree59ec22239b1c3cd23ec8e843249c85b543f679d2 /models
parentd06f96388d754ed41876f7fccb63f84241d44963 (diff)
parent3296708955e111579f00da8054ed2a4a86834766 (diff)
Merge branch 'feature/encoding-options' into develop
Diffstat (limited to 'models')
-rw-r--r--models/user.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/models/user.py b/models/user.py
index ea90f39..4d4887f 100644
--- a/models/user.py
+++ b/models/user.py
@@ -1,8 +1,9 @@
+"""Define a user."""
from os import urandom
from itsdangerous import URLSafeTimedSerializer
-from common.security import pwd_context, secret_key
+from common.security import pwd_context
class User(object):
@@ -57,3 +58,14 @@ class User(object):
else:
raise ValueError("No user")
+
+ def to_dict(self):
+ """Return a dict representation of the user."""
+ return_dict = dict()
+ for key, item in self.__dict__.items():
+ try:
+ return_dict[key] = item.to_dict()
+ except AttributeError:
+ return_dict[key] = item
+
+ return return_dict