Skip to content

Commit 74bfb44

Browse files
author
Systemaker
committed
update jsonify to return json response of single model
1 parent 631ed67 commit 74bfb44

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/modules/users/controllers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
# ------- IMPORT DEPENDENCIES -------
55
import datetime
6+
import json
67
import sendgrid
78
from flask import request, render_template, flash, current_app, redirect, abort, jsonify, url_for,g
89
from forms import *
@@ -51,7 +52,9 @@ def show(id=1):
5152
m_user = m_users.read_data(id)
5253
# html or Json response
5354
if request_wants_json():
54-
return jsonify(data = m_user)
55+
return jsonify({'id' : m_user.id,
56+
'email' : m_user.email,
57+
'username' : m_user.username})
5558
else:
5659
return render_template("users/show.html", user=m_user, app = app)
5760

0 commit comments

Comments
 (0)