summaryrefslogtreecommitdiff
path: root/models/user.py
diff options
context:
space:
mode:
Diffstat (limited to 'models/user.py')
-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