From 61fe144264a3304a5b5ce71bbbe80dc7e26e5608 Mon Sep 17 00:00:00 2001 From: Sachin Saxena Date: Thu, 4 Jan 2018 16:09:57 +0530 Subject: [PATCH] Duplicate function for restaurantMenu Function definition for restaurantMenu occuring twice and its not using menu template --- Lesson-3/12_Edit-Menu-Form/project.py | 28 +-------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/Lesson-3/12_Edit-Menu-Form/project.py b/Lesson-3/12_Edit-Menu-Form/project.py index 3dcdb86..93399e1 100644 --- a/Lesson-3/12_Edit-Menu-Form/project.py +++ b/Lesson-3/12_Edit-Menu-Form/project.py @@ -13,37 +13,11 @@ @app.route('/') -def restaurantMenu(restaurant_id): - restaurant = session.query(Restaurant).first() - items = session.query(MenuItem).filter_by(restaurant_id=restaurant.id) - output = '' - for i in items: - output += i.name - output += '
' - output += i.price - output += '
' - output += i.description - output += '
' - output += '
' - - return output - - @app.route('/restaurants//') def restaurantMenu(restaurant_id): restaurant = session.query(Restaurant).filter_by(id=restaurant_id).one() items = session.query(MenuItem).filter_by(restaurant_id=restaurant_id) - output = '' - for i in items: - output += i.name - output += '
' - output += i.price - output += '
' - output += i.description - output += '
' - output += '
' - - return output + return render_template('menu.html', restaurant=restaurant, items=items) @app.route('/restaurants//new', methods=['GET', 'POST'])