Samsquanch
Samsquanch

Reputation: 9146

Filter POST data in Django

I have a view in django that is going to save HTML data to a model, and I'm wondering how I might go about filtering it before saving it to the model? Are there built in functions for it? I know there are template filters, but I don't think those help me in this case.

What I'll be doing is getting the content of a div via JQuery, sending that to a view via ajax, then saving it to a model.

Upvotes: 0

Views: 724

Answers (2)

Guillaume Cisco
Guillaume Cisco

Reputation: 2945

You can use urllib module and these functions : http://docs.python.org/library/urllib.html#utility-functions

Upvotes: 0

second
second

Reputation: 28637

django takes care of safely storing strings in the database. html is a worry when displaying to the user, and django provides some help there as well, escaping html unless explicitly told not to

Upvotes: 1

Related Questions