@treeio_login_required
def ajax_subscription_lookup(request, response_format='html'):
 subscriptions = []
 if (request.GET and ('term' in request.GET)):
  subscriptions = Subscription.objects.filter(((Q(client__name__icontains=request.GET['term']) | Q(product__name__icontains=request.GET['term'])) | Q(details__icontains=request.GET['term'])))[:10]
 return render_to_response('sales/ajax_subscription_lookup', {'subscriptions': subscriptions}, context_instance=RequestContext(request), response_format=response_format)

@ treeio_login_required def ajax_subscription_lookup ( request , response_format = 'html' ) : subscriptions = [ ] if ( request . GET and ( 'term' in request . GET ) ) : subscriptions = Subscription . objects . filter ( ( ( Q ( client__name__icontains = request . GET [ 'term' ] ) | Q ( product__name__icontains = request . GET [ 'term' ] ) ) | Q ( details__icontains = request . GET [ 'term' ] ) ) ) [ : 10 ] return render_to_response ( 'sales/ajax_subscription_lookup' , { 'subscriptions' : subscriptions } , context_instance = RequestContext ( request ) , response_format = response_format )
returns a list of matching tasks .