Esempio n. 1
0
def poi_detail(request, poi_id):
    try:
        p = Poi.objects.get(poi_id=poi_id)
    except Poi.DoesNotExist:
        p = Poi(poi_id = poi_id)
        p.save()
        
    context = RequestContext(request, {
               'poi': p,
               'STATIC_URL' : STATIC_URL,
               })
        
    return render_to_response('poi/poi_detail.html', context)
Esempio n. 2
0
def poi_detail(request, poi_id, comments=False):
    try:
        p = Poi.objects.get(poi_id=poi_id)
    except Poi.DoesNotExist:
        p = Poi(poi_id=poi_id)
        p.save()
        
    data = {}
    
    data['id'] = poi_id
    data['get_preview_url'] = p.get_preview_url()
    data['coordinates'] = p.coordinates()
    data['properties'] = p.properties()
    
    if comments:
        data['comments'] = utils.get_comments_bean_list(p)
        
    data['rating'] = {
                      'user' : p.rating(user=request.user, category='poi'),
                      'overall' : p.rating()
                      }
        
    return HttpResponse(json.dumps(data, cls=DecimalEncoder), content_type="application/json")