@treeio_login_required
def ajax_contact_lookup(request, response_format='html'):
    "Returns a list of matching contacts"

    contacts = []
    if request.GET and 'term' in request.GET:
        user = request.user.profile
        contacts = Object.filter_permitted(user, Contact.objects,
                                           mode='x').filter(Q(name__icontains=request.GET['term']))[:10]

    return render_to_response('identities/ajax_contact_lookup',
                              {'contacts': contacts},
                              context_instance=RequestContext(request),
                              response_format=response_format)
dataset/ETHPy150Open treeio/treeio/treeio/identities/views.py/ajax_contact_lookup/original