예제 #1
0
def bush():

    print("Bush")

    """Renders the about page."""
    form1 = ExpandForm()
    form2 = CollapseForm()
    # df = pd.read_csv(path.join(path.dirname(__file__), 'static\\data\\trump.csv'))
    df = pd.read_csv(path.join(path.dirname(__file__), 'static/data/bush.csv'), encoding = "utf-8")
    raw_data_table = ''

    if request.method == 'POST':
        if request.form['action'] == 'Expand' and form1.validate_on_submit():
            raw_data_table = df.to_html(classes = 'table table-hover')
        if request.form['action'] == 'Collapse' and form2.validate_on_submit():
            raw_data_table = ''

    

    return render_template(
        'bush.html',
        title='Bush',
        year=datetime.now().year,
        message='Bush dataset page.',
        img_trump = '/static/imgs/bush.jpg',
        img_obama = '/static/imgs/bush.jpg',
        img_bush = '/static/imgs/bush.jpg',
        img_clinton = '/static/imgs/bush.jpg',
        raw_data_table = raw_data_table,
        form1 = form1,
        form2 = form2
    )
예제 #2
0
def ufcdata():

    form1 = ExpandForm()
    form2 = CollapseForm()
    df = pd.read_csv(path.join(path.dirname(__file__), 'static/data/data.csv'))
    raw_data_table = ''

    if request.method == 'POST':
        if request.form['action'] == 'Expand' and form1.validate_on_submit():
            raw_data_table = df.to_html(classes='table table-hover')
        if request.form['action'] == 'Collapse' and form2.validate_on_submit():
            raw_data_table = ''

    return render_template('ufcdata.html',
                           title='Data',
                           year=datetime.now().year,
                           message='UFC dataset page:',
                           img_trump='/static/imgs/ufc12.jpg',
                           img_obama='/static/imgs/ufc13.jpg',
                           img_bush='/static/imgs/ufc15.jpg',
                           img_clinton='/static/imgs/ufc14.jpg',
                           raw_data_table=raw_data_table,
                           form1=form1,
                           form2=form2)