def newRestaurant(): if request.method == "POST": restaurant = Restaurant(name = request.form["restaurant-name"], thumbnail_url = request.form["restaurant-image-url"]) if request.form["restaurant-description"]: restaurant.description = request.form["restaurant-description"] session.add(restaurant) session.commit() flash("New Restaurant Added") return redirect(url_for('index')) else: return render_template("new-restaurants.html", title="Add A New Restaurant")
def newRestaurant(): if request.method == "POST": restaurant = Restaurant( name=request.form["restaurant-name"], thumbnail_url=request.form["restaurant-image-url"]) if request.form["restaurant-description"]: restaurant.description = request.form["restaurant-description"] session.add(restaurant) session.commit() flash("New Restaurant Added") return redirect(url_for('index')) else: return render_template("new-restaurants.html", title="Add A New Restaurant")
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')