def login(secret): annotator = Annotator.by_secret(secret) if annotator is None: session.pop(ANNOTATOR_ID, None) session.modified = True else: session[ANNOTATOR_ID] = annotator.id return redirect(url_for('index'))
def annotator_dash(): action = request.form['action'] if action == 'Submit': csv = request.form['data'] data = utils.data_from_csv_string(csv) for row in data: annotator = Annotator(*row) db.session.add(annotator) db.session.commit() elif action == 'Delete': annotator_id = request.form['annotator_id'] try: db.session.execute( ignore_table.delete( ignore_table.c.annotator_id == annotator_id)) Annotator.query.filter_by(id=id).delete() db.session.commit() except IntegrityError as e: return render_template('error.html', message=str(e)) return redirect(url_for('admin'))
def get_current_annotator(): return Annotator.by_id(session.get(ANNOTATOR_ID, None))