How to save links with tags and parameters in TextField

Posted by xRobot on Stack Overflow See other posts from Stack Overflow or by xRobot
Published on 2010-05-27T16:04:29Z Indexed on 2010/05/27 16:41 UTC
Read the original article Hit count: 137

I have this simple Post model:

class Post(models.Model):

    title = models.CharField(_('title'), max_length=60, blank=True, null=True)
    body = models.TextField(_('body'))
    blog = models.ForeignKey(Blog, related_name="posts")
    user = models.ForeignKey(User)     

I want that when I insert in the form the links, then these links are saved in the body from this form:

http://www.example.com or www.example.com

to this form ( with tag and rel="nofollow" parameter ):

<a href="http://www.example.com" rel="nofollow">www.example.com</a>

How can I do this ?

Thanks ^_^

© Stack Overflow or respective owner

Related posts about django

Related posts about django-models