Exemple #1
0
def debug():
    user_id = session['user_id']
    database = Database(filename)
    user_group = database.findUserGroup(user_id)
    user_name = database.findUserName(user_id)
    return render_template('debug.html',
                           user_id=user_id,
                           user_group=user_group,
                           user_name=user_name,
                           language=session['language'])
Exemple #2
0
def my_recipes():
    if 'user_id' in session:
        user_id = session['user_id']
        database = Database(filename)
        user_name = database.findUserName(user_id)
        user_group = database.findUserGroup(user_id)
        if user_group == 2:
            return "您必须先验证邮箱才能使用功能"
        recipes = database.deliverMyRecipe(user_id)
        return render_template('my_recipes.html',
                               user_id=session['user_id'],
                               recipes=recipes,
                               user_name=user_name,
                               language=session['language'])
    return render_template('login_name.html', language=session['language'])
Exemple #3
0
def fridges():
    if 'user_id' in session:
        database = Database(filename)
        user_id = session['user_id']
        user_name = database.findUserName(user_id)
        user_group = database.findUserGroup(user_id)
        if user_group == 2:
            return "您必须先验证邮箱才能使用功能"
        #user_id = 1
        fridges = database.deliverFridge(user_id)
        if len(fridges) != 0:
            fridges = fridges[0][1].split(' ')
        # now fridges is a list of stock
        return render_template('fridges.html',
                               user_id=session['user_id'],
                               fridges=fridges,
                               user_name=user_name,
                               language=session['language'])
    return render_template('login_name.html', language=session['language'])