server.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:hb-final-project 作者: kjlundsgaard 项目源码 文件源码
def return_restaurants():
    """Gives response to browser of restaurants in db for given list"""

    list_id = request.form.get('list_id')
    item_id = request.form.get('id')
    restaurants_lists = RestaurantList.query.filter_by(list_id=list_id, visited=False).all()

    restaurants = []
    for item in restaurants_lists:
        restaurant = Restaurant.query.filter_by(restaurant_id=item.restaurant_id).first()

        restaurants.append({'restaurant_name': restaurant.restaurant_name,
                            'yelp_rating': restaurant.yelp_rating,
                            'latitude': restaurant.latitude,
                            'longitude': restaurant.longitude,
                            'restaurant_id': restaurant.restaurant_id})

    print restaurants
    return jsonify(status="success", results=restaurants, id=item_id)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号