python - How do I write a Django template custom tag that adds a slash before a single quote? -
Am I doing this right? (Maybe not ... is there any right? Thanks)
Filter with the exact same name:
This also avoids double quotes, and double slash. If you want only single quotes, you have to customize it and give it a different name.
The original works here:
def addslashes (value): "" It is useful to avoid strings in CSV, for example, to avoid javascript Less is useful, instead use `` `` AJAX`` filter. ('' ',' \\ '). ("'," \\ ") adds add_shes_safe = true addlashes = stringfilter (addslashes)
Comments
Post a Comment