Use
 {{yourvar|html|striptags}}

https://docs.djangoproject.com/en/dev/ref/templates/builtins/#striptags
Cheers
*Laxmikant Gurnalkar*
On Fri, Oct 5, 2012 at 2:32 PM, Ashish Jain <ashishjain....@gmail.com>wrote:

> 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<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+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
*

 GlxGuru

*

-- 
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.

Reply via email to