Exemplo n.º 1
0
def showRestaurant(restaurant_id):
    restaurant = rest_crud.getRestaurant(restaurant_id)
    creator = rest_crud.getUserById(restaurant.user_id)
    menu_items = rest_crud.getRestaurantItems(restaurant_id)
    sections= OrderedDict()
    sections['Appetizers'] = [item for item in menu_items if item.course == "Appetizer"]
    sections['Entrees'] = [item for item in menu_items if item.course == "Entree"]
    sections['Desserts'] = [item for item in menu_items if item.course == "Dessert"]
    sections['Beverages'] = [item for item in menu_items if item.course == "Beverage"]
    if 'username' not in login_session or login_session['user_id'] != restaurant.user_id:
        print "user not logged in"
        return render_template('menu.html', restaurant=restaurant,
                                            sections=sections,
                                            creator=creator)
    else:
        return render_template('editrestaurant.html', restaurant=restaurant,
                                                      sections=sections,
                                                      creator=creator)
Exemplo n.º 2
0
def getUserJSON(user_id):
    user = rest_crud.getUserById(user_id)
    return jsonify(User=user.serialize)