Example #1
0
def training():

    if 'username' not in session:
        return redirect(url_for('login'))

    if chache[session['username']]['statustraining'] == 0 and session[
            'process_training']:
        session['process_training'].remove(1)
        session.modified = True

    modellabel = Model()
    emoticon = modellabel.select_label()
    modellabel.close_connection()

    return render_template('admin/pages/training.html',
                           username=session['username'],
                           training=session['process_training'],
                           emoticon=emoticon)
Example #2
0
def table_label():

    if request.data:
        username = json.loads(request.data).get('username')

        try:
            if session['username'] == username:
                modellabel = Model()
                result = modellabel.select_label()
                data = {}
                data.setdefault('data', result)
                modellabel.close_connection()

                return jsonify(data)

            else:
                return redirect(url_for('login'))

        except Exception as error:
            print(error)
            return redirect(url_for('login'))

    else:
        return redirect(url_for('login'))