Re: What is Django/python equivalent of this - Display textarea content with line breaks in html page?

2009-01-10 Thread Brian Neal

On Jan 10, 8:13 pm, zweb  wrote:
> Javascript:
> document.getElemnetById(’textareacontent’).value.replace(/\n/
> g,’’);
> PHP:
> preg_replace(”/\n/”,””,$_REQUEST['t1']);
> Ruby:
> (teaxtareacontent).gsub(/\n/,””)
>
> ( reference 
> -http://rkutti.wordpress.com/2008/01/31/display-textarea-content-with-...)

I'm not exactly sure what you mean, as you don't want to put a 
inside a text area without escaping it.

If you are talking about displaying text that you got from a text
area, then the PHP idiom is nl2br().

In Django templates, see the linebreaks and linebreaksbr filters:

http://docs.djangoproject.com/en/dev/ref/templates/builtins/#linebreaks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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
-~--~~~~--~~--~--~---



What is Django/python equivalent of this - Display textarea content with line breaks in html page?

2009-01-10 Thread zweb


Javascript:
document.getElemnetById(’textareacontent’).value.replace(/\n/
g,’’);
PHP:
preg_replace(”/\n/”,””,$_REQUEST['t1']);
Ruby:
(teaxtareacontent).gsub(/\n/,””)

( reference - 
http://rkutti.wordpress.com/2008/01/31/display-textarea-content-with-line-breaks-in-html-page/)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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
-~--~~~~--~~--~--~---