예제 #1
0
파일: views.py 프로젝트: zouf/AllSortz
def search(request):
    form = request.GET
    if 'search' not in form:
        return index(request)
    term = form['search']
    location = form['location']
    
    #TODO fix getting location
    if location == "":
        #handle blank location with IP track!!!
        location = get_default()
        
    business_list = search_site(term, location)
    businesses = get_bus_data(business_list,request.user,True)
        

    context = get_default_blank_context(request.user)
    context.update( {
        'search_term' : term,
        'business_list' : businesses,
        'nonempty' : True,
        'all_businesses' : businesses,
        'page_template': "ratings/listing/entry.html",
    } )
    return render_to_response('ratings/sort.html',  context_instance=RequestContext(request,context))
예제 #2
0
파일: views.py 프로젝트: zouf/AllSortz
def detail_activity(request, act_id):
    activity = get_object_or_404(Activity, pk=act_id)
    
    if request.method == 'POST':  # add a business
        form = ActivityWaypointForm(request.POST, request.FILES)
        business = Business.objects.get(id=form.data['business'])
        aw = add_to_activity(activity,business)
        aw.save()
    waypoints = ActivityWaypoint.objects.filter(activity=activity)
    business_list = get_bus_data(Business.objects.all(),request.user)
    #business_list = paginate_businesses(business_list,request.GET.get('page'),5)
    waypoint_form = ActivityWaypointForm()
    latlng = get_avg_latlng(business_list)   
    
    return render_to_response('activities/detail.html', {'businesses':Business.objects.all(), 'waypoint_form': waypoint_form, 'waypoints':waypoints, 'activity': activity,'business_list':business_list, 'baselat':latlng[0], 'baselng':latlng[1]}, context_instance=RequestContext(request))