@treeio_login_required
def ajax_agent_lookup(request, response_format='html'):
 agents = []
 if (request.GET and ('term' in request.GET)):
  agents = ServiceAgent.objects.filter((Q(related_user__name__icontains=request.GET['term']) | Q(related_user__contact__name__icontains=request.GET['term'])))
 return render_to_response('services/ajax_agent_lookup', {'agents': agents}, context_instance=RequestContext(request), response_format=response_format)

@ treeio_login_required def ajax_agent_lookup ( request , response_format = 'html' ) : agents = [ ] if ( request . GET and ( 'term' in request . GET ) ) : agents = ServiceAgent . objects . filter ( ( Q ( related_user__name__icontains = request . GET [ 'term' ] ) | Q ( related_user__contact__name__icontains = request . GET [ 'term' ] ) ) ) return render_to_response ( 'services/ajax_agent_lookup' , { 'agents' : agents } , context_instance = RequestContext ( request ) , response_format = response_format )
returns a list of matching agents .