示例#1
0
def index():
    form = ChoiceForm()

    form.opts.query = Choice.query.filter(Choice.id > 1)

    if form.validate_on_submit():
        return '<html><h1>{}</h1></html>'.format(form.opts.data)

    return render_template('nowy.html', form=form)
示例#2
0
def index():
    form = ChoiceForm()
    mymap = None
    list_recomm = []
    if form.validate_on_submit():
        #flash('User1_choice: {},  User2_choice: {}, located at ={}'.format(
        #form.choice1.data, form.choice2.data, form.zipcode.data))
        df_rest = pd.read_pickle("newdf_LVrestaurants25samples.pkl")
        df = process_restaurants(df_rest,
                                 form.choice1.data,
                                 form.choice2.data,
                                 user_zip=form.zipcode.data)
        mymap = googlemap(
            "my_awesome_map",
            style="height:600px;width:1100px; margin:0;",
            zoom=11,
            lat=36.114647,
            lng=-115.172813,
            markers=[{
                'icon':
                'http://maps.google.com/mapfiles/ms/icons/green-dot.png',
                'lat': df.latitude.values[x],
                'lng': df.longitude.values[x],
                'infobox': df.name.values[x]
            } for x in range(0, 5)])
        list_recomm = [df.name.values[x] for x in range(0, 5)]
        #flash(df[2]['name'] + ', ' + df[3]['name'] + ', ' + df[4]['name'] + 'and  ' + df[5]['name'])
        return render_template('index.html',
                               title='Choosing the best restaurant',
                               form=form,
                               list_recomm=list_recomm,
                               mymap=mymap)
    else:
        mymap = googlemap("my_awesome_map",
                          style="height:450px;width:1000px; margin:0;",
                          zoom=11,
                          lat=36.114647,
                          lng=-115.172813)
    return render_template('index.html',
                           title='Choosing the best restaurant',
                           form=form,
                           list_recomm=list_recomm,
                           mymap=mymap)