Skip to content
Snippets Groups Projects
Commit a49cd7be authored by Dichi13's avatar Dichi13
Browse files

added admin to subdata

parent 23384ff0
1 merge request!5Develop
Pipeline #14445 canceled with stage
...@@ -31,20 +31,33 @@ def get_page(): ...@@ -31,20 +31,33 @@ def get_page():
try: try:
vdata = db.VizData.objects.with_id(data_id) vdata = db.VizData.objects.with_id(data_id)
if vdata is not None: if vdata is not None:
subdata = [child for child in vdata.subdata]
resp = { resp = {
"status":200, "status":200,
"data":vdata, "data":vdata,
"subdata":[child for child in vdata.subdata] "subdata":subdata
} }
if return_admin: if return_admin:
admins = db.User.objects(page_list__in = [vdata.id]) admins = db.User.objects(page_list__in = [vdata.id])
if len(admins) > 0: if len(admins) > 0:
admin = admins[0] admin = admins[0]
del admin.password del admin.password
del admin.page_list del admin.page_list
resp["admin"] = admin vdata["admin"] = admin
else: else:
resp["admin"] = None vdata["admin"] = None
for x in subdata:
admins = db.User.objects(page_list__in = [x.id])
if len(admins) > 0:
admin = admins[0]
del admin.password
del admin.page_list
x["admin"] = admin
else:
x["admin"] = None
return jsonify(resp) return jsonify(resp)
else: else:
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment