Source

django-jquery / jquery / views.py

Full commit
from django.contrib.auth.decorators import login_required
from django.views.generic.simple import direct_to_template
from django.template import RequestContext
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt

def get_csrf(request):
    return direct_to_template(request, 'ajax_helper/csrf_token', {})

@csrf_exempt
def echo(request):
    filename = request.POST.get('filename', 'noname.bin')
    response = HttpResponse(request.POST.get('data'), content_type=request.POST.get('content_type'))
    response['Content-Disposition'] = 'attachment; filename=%s' % filename
    return response