The following code in one of my views returns unescaped html string which cannot be parsed in frontend since it is an Ajax request.
return render_to_response
To return just plain HTML to the client from within your view, use django.http.HttpResponse
from django.http import HttpResponse
def view(request)
# Do stuff here
output = '''
Hey mum!
'''
return HttpResponse(output)
To prevent the Django templating system from escaping HTML in a template, just use the |safe
filter:
response = "
"
# Meanwhile, in the template...
{{response|safe}}