def file_autocomplete(request, project_slug):
 if ('term' in request.GET):
  term = request.GET['term']
 else:
  raise Http404
 queryset = ImportedFile.objects.filter(project__slug=project_slug, path__icontains=term)[:20]
 ret_list = []
 for filename in queryset:
  ret_list.append({'label': filename.path, 'value': filename.path})
 json_response = json.dumps(ret_list)
 return HttpResponse(json_response, content_type='text/javascript')

def file_autocomplete ( request , project_slug ) : if ( 'term' in request . GET ) : term = request . GET [ 'term' ] else : raise Http404 queryset = ImportedFile . objects . filter ( project__slug = project_slug , path__icontains = term ) [ : 20 ] ret_list = [ ] for filename in queryset : ret_list . append ( { 'label' : filename . path , 'value' : filename . path } ) json_response = json . dumps ( ret_list ) return HttpResponse ( json_response , content_type = 'text/javascript' )
return a json list of file names .