I have yet to try your suggestion, but this looks great! I am really looking forward to trying it, thanks!!
On Mar 3, 4:54 pm, Jervis <jerv...@whit.com.au> wrote: > On Mar 3, 3:51 pm, slenno1 <slen...@gmail.com> wrote: > > > Hey everyone, > > I am currently working with a section of a site that takes user > > input usingDjangoforms: > > > description = forms.CharField(widget=forms.Textarea(attrs={'rows': > > '10', 'cols': '80'})) > > > The only problem however is that this ignores anyhtmltags that are > > added in by the user and just prints them along with the text entered > > in by the user. For example, a user may type in "The quick brown fox > > <b>jumps</b> over the lazy dog", with the word 'jumps' intended to be > > bold, but thehtmltags are just printed a long with the text. Is this > > because I am possibly using the wrong widget? Any feedback is greatly > > appreciated, thanks! > > Hi, in your template where you have placed {{ model.description }}Djangowill > automatically escape thehtmltags you place have input. > The effect is what you are seeing now, they are displayed as text, > rather than being interpreted ashtmltags. You can selectively turn > this default behaviour off by marking the text as "safe" > > {{ model.description|safe }} > > The use of the word "safe" here implies that you are entirely sure > that the content of "description" won't contain anything that will > harm your website or your customers. The discussion about what can be > considered "safe" has been had many times and it may pay you well to > do some light reading on the matter. Many people use intermediate > markup languages that don't have the full power ofhtml,Djangoitself > provides template tags that can aid in rendering > themhttp://docs.djangoproject.com/en/dev/ref/contrib/#markupan example of > on is herehttp://en.wikipedia.org/wiki/Textile_(markup_language). > > Best of luck. > > Jervis -- 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.