On Sun, 2007-12-02 at 18:26 -0800, [EMAIL PROTECTED] wrote:
> i have field like this:
>                             body = models.TextField()
> i want it only accept text without HTML code?
> i used body=markdown.markdown(text,safe_mode = True), but this will
> repalce HTML code with "HTML_REMOVED".
> 
> is there other way can make sure only text content? thanks!

You could run it through BeautifulSoup ([1]) and then extract the
contents from each node in the tree. Not blindingly fast, but pretty
robust.

[1] http://www.crummy.com/software/BeautifulSoup/

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to