Skip to content

Instantly share code, notes, and snippets.

@milin
Created August 16, 2011 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milin/1150422 to your computer and use it in GitHub Desktop.
Save milin/1150422 to your computer and use it in GitHub Desktop.
if form.is_valid():
form.save()
response = JsonResponse(template.loader.render_to_string('email_results.html', context))
print response.content
response.content = "<html><body><textarea>%s</textarea></body></html>" % response.content
response['Content-Type'] = 'text/html'
return response
else:
response = JsonResponse(error=iriencode(context['form'].as_p()))
response.content = "<html><body><textarea>%s</textarea></body></html>" % response.content
response['Content-Type'] = 'text/html' # Dojo needs this
return response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment