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

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

    return render_to_response('identities/ajax_location_lookup',
                              {'locations': locations},
                              context_instance=RequestContext(request),
                              response_format=response_format)


#
# Widgets
#
dataset/ETHPy150Open treeio/treeio/treeio/identities/views.py/ajax_location_lookup/swapped operands of `in`