Example #1
0
def member_action(request):
    
    #first try to get user's given location
    try:
        user  = User.objects.get(email=request.user)
        near_string = user.get_user_address()
        based_on = "(based on the address in your profile)"
        job_data = get_local_places(near_string)['venues']
    except:
        try:
            #if this fails then try to get geoip
            geo_ip = get_geoip(request)
            near_string = geo_ip['city'] + ", " + geo_ip['region']
            based_on = "(based on your current location)"
            job_data = get_local_places(near_string)['venues']
        except:
            near_string = "Toronto, Ontario"
            based_on = "(because we have no idea where you are or what you can do!)"
            job_data = get_local_places(near_string)['venues']
    
    context = {'job_data': job_data,
               'location': {'address': near_string, 'based_on': based_on}
                }
    
    return render_to_response("member/member-action.html", context, RequestContext(request))
Example #2
0
def landing_index(request):
    geo_ip = get_geoip(request)
    location = " local employers"
    try:
        if geo_ip['city'] != '':
            location += " in " + geo_ip['city']
        else:
            print "city is blank"
    except:
        print "no city found"
    headline_text = "to 600+" + location
    print headline_text
    context = {'headline_text': headline_text}
    return render(request, 'visitor/landing-index.html', context)