Beispiel #1
0
def place(request, place_id):
    req = HttpRequest()
    req.GET['_id'] = place_id
    result = util_views.get_place(req)
    result = simplejson.loads(result.content)
    
    data = {
      "title": result['title'],
      "place_id": result['place_id'],
      'address': result['address'],
      'phone': result['phone'],
      'tag_list': result['tag_list'],
      'stay_time': result['stay_time'],
      'lat': result['lat'],
      'lng': result['lng'],
      'images': result['images'],
      'nearbys': result['nearbys'],
      'mrt': result['mrt'],
      'holiday': result['holiday'],
      'office_hour': result['office_hour'],
      'shop_info': result['shop_info'],
      'media_report': result['media_report'],
      'avg_price': result['avg_price'],
      'capacity': result['capacity'],
      'media_suggest': result['media_suggest'],
      'place_added': result['place_added'],
      'snippets': result['snippets'],
    }
    return render_to_response('place.html', data,
                              context_instance=RequestContext(request))
Beispiel #2
0
def result(request):
    place_list = []
    place_latlng = []
    place_name = []
    req = HttpRequest()
    db_ = util_views._get_database()
    added_place = db_.added_place
    res = added_place.find({})
    for r in res:
      req.GET['_id'] = r['place_id']
      result = util_views.get_place(req)
      result = simplejson.loads(result.content)
      
      data = {
        "title": result['title'],
        "place_id": result['place_id'],
        'address': result['address'],
        'phone': result['phone'],
        'tag_list': result['tag_list'],
        'stay_time': result['stay_time'],
        'lat': result['lat'],
        'lng': result['lng'],
        'images': result['images'][0],
        'nearbys': result['nearbys'],
        'mrt': result['mrt'],
        'holiday': result['holiday'],
        'office_hour': result['office_hour'],
        'shop_info': result['shop_info'],
        'media_report': result['media_report'],
        'avg_price': result['avg_price'],
        'capacity': result['capacity'],
        'media_suggest': result['media_suggest'],
        'place_added': result['place_added'],
      }

      place_list.append(data)
      place_latlng.append("[%f,%f]" % (result['lat'], result['lng']));
      place_name.append("'" + result['title'] + "'");

    data = {
      "place_list": place_list,
      "place_name": "var place_name = [%s]" % ",".join(place_name),
      "place_latlng": "var waypoint = [%s]" % ",".join(place_latlng),
      'place_start': request.GET.get("place_start"),
      'place_end': request.GET.get("place_end"),
      'start_latlng': request.GET.get("start_latlng"),
      'end_latlng': request.GET.get("end_latlng"),
    }
    return render_to_response('result.html', data,
                              context_instance=RequestContext(request))
Beispiel #3
0
def route(request):
    place_list = []
    req = HttpRequest()
    db_ = util_views._get_database()
    added_place = db_.added_place
    res = added_place.find({})
    for r in res:
      req.GET['_id'] = r['place_id']
      result = util_views.get_place(req)
      result = simplejson.loads(result.content)
      
      data = {
        "title": result['title'],
        "place_id": result['place_id'],
        'address': result['address'],
        'phone': result['phone'],
        'tag_list': result['tag_list'],
        'stay_time': result['stay_time'],
        'lat': result['lat'],
        'lng': result['lng'],
        'images': result['images'][0],
        'nearbys': result['nearbys'],
        'mrt': result['mrt'],
        'holiday': result['holiday'],
        'office_hour': result['office_hour'],
        'shop_info': result['shop_info'],
        'media_report': result['media_report'],
        'avg_price': result['avg_price'],
        'capacity': result['capacity'],
        'media_suggest': result['media_suggest'],
        'place_added': result['place_added'],
      }

      place_list.append(data)

    data = {
      "place_list": place_list,
    }
    return render_to_response('route.html', data,
                              context_instance=RequestContext(request))