aboutsummaryrefslogtreecommitdiffstats
path: root/src/api
diff options
context:
space:
mode:
authorSean Smith <ssmith@iol.unh.edu>2020-07-23 14:49:22 -0400
committerSean Smith <ssmith@iol.unh.edu>2020-07-23 14:50:47 -0400
commit5dbda20387da04c28a71da894e5b814d47647a9d (patch)
tree9bac1fa2a6b51aa9599390b9628e82d4957d32eb /src/api
parent682f7ebb6d0be5ddd8e4c699e1f87fc20a3fe1e3 (diff)
Fixes get_user for api.
Change-Id: I2111c8dc3a66dc1e6d4b8ccab53d4a14acafd913 Signed-off-by: Sean Smith <ssmith@iol.unh.edu>
Diffstat (limited to 'src/api')
-rw-r--r--src/api/models.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/api/models.py b/src/api/models.py
index addc02d..960fc26 100644
--- a/src/api/models.py
+++ b/src/api/models.py
@@ -176,12 +176,12 @@ class LabManager(object):
def format_user(self, userprofile):
return {
- "id": userprofile.user.id,
- "username": userprofile.user.username,
- "email": userprofile.email_addr,
- "first_name": userprofile.user.first_name,
- "last_name": userprofile.user.last_name,
- "company": userprofile.company
+ "id": userprofile.user.id,
+ "username": userprofile.user.username,
+ "email": userprofile.email_addr,
+ "first_name": userprofile.user.first_name,
+ "last_name": userprofile.user.last_name,
+ "company": userprofile.company
}
def get_users(self):
@@ -190,7 +190,9 @@ class LabManager(object):
return json.dumps({"users": userlist})
def get_user(self, user_id):
- profile = get_object_or_404(UserProfile, pk=user_id)
+ user = User.objects.get(pk=user_id)
+
+ profile = get_object_or_404(UserProfile, user=user)
return json.dumps(self.format_user(profile))