Sanitizing HTML in submitted form data

strip_tags actually removes the tags from the input, which may not be what you want.

To convert a string to a “safe string” with angle brackets, ampersands and quotes converted to the corresponding HTML entities, you can use the escape filter:

from django.utils.html import escape
message = escape(form.cleaned_data['message'])

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)