def get_user_list_json(request): query = request.POST.get('query', '') visited = request.POST.getlist('visited[]') visited.append(request.user.email) print >>sys.stderr, visited user_list = find_users_from_query(request.user, query, NON_GROUPED, \ visited = visited) return HttpResponse(json.dumps(user_list), mimetype='application/json')
def search_user(request): query = request.GET.get('query', '') print >>sys.stderr, query template = loader.get_template('search_user.html') user_list = find_users_from_query(request.user, query, GROUPED) context = RequestContext(request, {'email': request.user.email, \ 'name': request.user.first_name, \ 'users': json.dumps(user_list), \ 'query': query, 'origin': 'search'}) return HttpResponse(template.render(context))