Esempio n. 1
0
def newRestaurant():
    if request.method == 'POST':
        restaurant = Restaurant()
        restaurant.name = request.form['name']
        restaurant.category = request.form['category']
        restaurant.description = request.form['description']
        restaurant.rating = request.form['rating']
        restaurant.price_range = request.form['price_range']
        restaurant.address = request.form['address']
        restaurant.latlng = request.form['latlng']
        restaurant.telephone = request.form['telephone']
        restaurant.url = request.form['url']
        restaurant.hours = request.form['hours']
        restaurant.image_url = request.form['image_url']
        sqlsession.add(restaurant)
        sqlsession.commit()
        flash("New Restaurant Created")
        return redirect(url_for('showRestaurants'))
    else:
        return render_template('newRestaurant.html')