From 4d452d47ea9458facbb5b99290a7e8c8f0f9e9c2 Mon Sep 17 00:00:00 2001 From: Robbe Van Herck Date: Thu, 12 Jul 2018 22:31:08 +0200 Subject: [PATCH] Fixed slight mistake in adding achievements --- user.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/user.py b/user.py index fcd94ce..1abe809 100644 --- a/user.py +++ b/user.py @@ -12,12 +12,12 @@ def add_achievement(id): name = request.args.get("name") if not name: return "No name supplied" - a = Achievement(name=name, achieved_by=current_user.id) - db.session.add(a) + achievement = Achievement(name=name, achieved_by=id) + achievement.endorsed_by.append(current_user) + db.session.add(achievement) db.session.commit() return "OK" - @app.route("/users/") def get_user(id): user = User.query.filter_by(id=id).first()