def search_autocomplete(request):
 if ('term' in request.GET):
  term = request.GET['term']
 else:
  raise Http404
 queryset = Project.objects.public(request.user).filter(name__icontains=term)[:20]
 ret_list = []
 for project in queryset:
  ret_list.append({'label': project.name, 'value': project.slug})
 json_response = json.dumps(ret_list)
 return HttpResponse(json_response, content_type='text/javascript')

def search_autocomplete ( request ) : if ( 'term' in request . GET ) : term = request . GET [ 'term' ] else : raise Http404 queryset = Project . objects . public ( request . user ) . filter ( name__icontains = term ) [ : 20 ] ret_list = [ ] for project in queryset : ret_list . append ( { 'label' : project . name , 'value' : project . slug } ) json_response = json . dumps ( ret_list ) return HttpResponse ( json_response , content_type = 'text/javascript' )
return a json list of project names .