On Fri, May 21, 2010 at 6:12 PM, nameless <xsatelli...@gmail.com> wrote:
>
>
> I have a simple Blog model with a TextField. What is the best way to
> save links in the TextField ?
>
> 1) Saving link in the database in this form: http://www.example.com
> and then using some filter in the template to trasform it in form:
>
> <a rel="nofollow" href="http://www.example.com>http://www.example.com</
> a>
>
> 2) Saving link in the database directly in this form:
>
> <a rel="nofollow" href="http://www.example.com>http://www.example.com</
> a>
>

I think you are talking about pre-render vs post-render of a text. In
both case you use
a filter or processor to transform the raw text into html (or other format).

afaik, most efficient is pre-render. You just create an extra field
non-editable by the user,
e.g.

class Foo(...)
    text = TextField()
    text_html = TextField()

And using pre-save signal for Foo model you can process the raw text
and store it in text_html field.
When you display the rendered text you just show text_html field in
your templates.

Hope it helps.

~Rolando

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to