def list_all_directors():
    directors = db_helper.get_directors()
    if 'user_id' not in login_session:
        user = None
    else:
        user = db_helper.get_user_info(login_session['user_id'])
        directors = db_helper.get_directors_by_creator_id(user.id)
    if not directors:
        flash("No director on the list. Let's add one")
    return render_template('index.html', directors=directors, user=user)
Esempio n. 2
0
def list_all_directors():
    directors = db_helper.get_directors()
    if 'user_id' not in login_session:
        user = None
    else:
        user = db_helper.get_user_info(login_session['user_id'])
        directors = db_helper.get_directors_by_creator_id(user.id)
    if not directors:
        flash("No director on the list. Let's add one")
    return render_template('index.html', directors=directors, user=user)
def check_creator(user_id):
    '''helper function to check original creator
    Return:
        False, redirect to index page if not match
    '''
    creator = db_helper.get_user_info(user_id)
    if creator.id != login_session['user_id']:
        flash("ERROR, the information is not belong to "
              "{name}.".format(name=login_session['username']))
        return False
    return True
Esempio n. 4
0
def check_creator(user_id):
    '''helper function to check original creator
    Return:
        False, redirect to index page if not match
    '''
    creator = db_helper.get_user_info(user_id)
    if creator.id != login_session['user_id']:
        flash("ERROR, the information is not belong to "
              "{name}.".format(name=login_session['username']))
        return False
    return True