diff --git a/app.py b/app.py index 4996d52..420b868 100755 --- a/app.py +++ b/app.py @@ -188,6 +188,10 @@ def user_settings(): return 'flipped. find more is ' + display +def no_existing_edit(item_id, depicts_id): + q = Edit.query.filter(painting_id=item_id, depicts_id=depicts_id) + return q.count() == 0 + @app.route('/save/Q', methods=['POST']) def save(item_id): depicts = request.form.getlist('depicts') @@ -213,6 +217,10 @@ def save(item_id): database.session.add(depicts_item) database.session.commit() + assert no_existing_edit(item_id, depicts_id) + + for depicts_qid in depicts: + depicts_id = int(depicts_qid[1:]) r = create_claim(item_id, depicts_id, token) reply = r.json() if 'error' in reply: