Hey-
First time posting here so hopefully I explain everything correctly.
class sendbackcurricula(app.page):
def GET(self):
query = models.Curricula.query.all()
map = dict()
for x in query:
x = x.to_dict()
map[x['owner_id']] = x['title']
return json.dumps(map);
The above code will return the last element held in the database at 'owner_id' and 'title'. The problem is I want to return all the elements for each owner_id. For example: owner_id = 'email' and holds 'Course1', 'Course2', 'Course3'. When this code is run it returns {"email": "Course3}. I tried adding map2 = dict() and adding the contents of the map to map2 while in the for loop, but this did not work.
Any help would be great!
Thanks!