def wrapper(request, *args, **kwargs):
    if request.user.is_authenticated():
        return view_func(request, *args, **kwargs)
json = simplejson.dumps({'not_authenticated': True})
return HttpResponse(json, mimetype='application/json')
Django authentication and Ajax - URLs that require login