Re: Print html the normal way
Hi,
Thanks a ton!!
using mark_safe() worked perfectly.
- Regards
Ashish
On Friday, 5 October 2012 14:10:31 UTC+5:30, Tom Evans wrote:
On Fri, Oct 5, 2012 at 9:20 AM, Ashish Jain <ashishj...@gmail.com> wrote:--
> Hi,
>
> I wrote a simple filter as:
>
> @register.filter()
> def html(value):
> return '<p>Check</p>'
>
> when I use this filter in my template, it displays html as:
>
> <p>Check</p>
>
> I want to display as:
>
> Check
>
> am I missing something.
>
You haven't marked the output as safe, so Django escapes it:
https://docs.djangoproject.com/en/1.4/howto/custom- template-tags/#filters-and- auto-escaping
You want option 2.
Cheers
Tom
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Sz5auuOkyYcJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home