Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > How to print html in python the normal way

Reply
Thread Tools

How to print html in python the normal way

 
 
ashishjain.ash@gmail.com
Guest
Posts: n/a
 
      10-04-2012
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.

- Thanks for your help
Ashish
 
Reply With Quote
 
 
 
 
Chris Angelico
Guest
Posts: n/a
 
      10-04-2012
On Thu, Oct 4, 2012 at 9:24 PM, <(E-Mail Removed)> wrote:
> am I missing something.


The first thing you're missing is more detail in your question. My
crystal ball tells me you're using some kind of web framework and
viewing this in your browser. And my second crystal ball suggests that
it's probably Django. But is this correct? Lots more detail, please!

ChrisA
 
Reply With Quote
 
 
 
 
Ramchandra Apte
Guest
Posts: n/a
 
      10-04-2012
On Thursday, 4 October 2012 17:00:57 UTC+5:30, Chris Angelico wrote:
> On Thu, Oct 4, 2012 at 9:24 PM, <(E-Mail Removed)> wrote:
>
> > am I missing something.

>
>
>
> The first thing you're missing is more detail in your question. My
>
> crystal ball tells me you're using some kind of web framework and
>
> viewing this in your browser. And my second crystal ball suggests that
>
> it's probably Django. But is this correct? Lots more detail, please!
>
>
>
> ChrisA


+1
 
Reply With Quote
 
Ramchandra Apte
Guest
Posts: n/a
 
      10-04-2012
On Thursday, 4 October 2012 17:00:57 UTC+5:30, Chris Angelico wrote:
> On Thu, Oct 4, 2012 at 9:24 PM, <(E-Mail Removed)> wrote:
>
> > am I missing something.

>
>
>
> The first thing you're missing is more detail in your question. My
>
> crystal ball tells me you're using some kind of web framework and
>
> viewing this in your browser. And my second crystal ball suggests that
>
> it's probably Django. But is this correct? Lots more detail, please!
>
>
>
> ChrisA


+1
 
Reply With Quote
 
Joel Goldstick
Guest
Posts: n/a
 
      10-04-2012
On Thu, Oct 4, 2012 at 9:11 AM, Ramchandra Apte <(E-Mail Removed)> wrote:
> On Thursday, 4 October 2012 17:00:57 UTC+5:30, Chris Angelico wrote:
>> On Thu, Oct 4, 2012 at 9:24 PM, <(E-Mail Removed)> wrote:
>>
>> > am I missing something.

>>
>>

You should look at the built in django tags, and learn about them
before writing your own

In this case, look here:
https://docs.djangoproject.com/en/de...lates/#filters


striptags

Strips all [X]HTML tags. For example:

{{ value|striptags }}

If value is "<b>Joel</b> <button>is</button> a <span>slug</span>",
the output will be "Joel is a slug".

Again, these are just a few examples; see the built-in filter
reference for the complete list.



--
Joel Goldstick
 
Reply With Quote
 
ashishjain.ash@gmail.com
Guest
Posts: n/a
 
      10-05-2012
Hi,

Thanks for the reply.
Apologies for my question not clear. Yes I am using django framework for it.

- Regards
Ashish
 
Reply With Quote
 
ashishjain.ash@gmail.com
Guest
Posts: n/a
 
      10-05-2012
Hi,

Thanks for the reply.
Apologies for my question not clear. Yes I am using django framework for it.

- Regards
Ashish
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
.NET-ey way to convert XML-encoded/escaped entities into normal characters/HTML? ASP .Net 2 06-20-2007 05:32 PM
Problem - I want to print Current Output of Pdf file and should print once.I get print dialog box but it is not working keto Java 0 05-30-2007 11:27 AM
How to know the inline-function was implemented the inline way or normal way? ypjofficial@indiatimes.com C++ 7 07-18-2006 11:22 PM
Unlarging the print to print using PDF file to print Bun Mui Computer Support 3 09-13-2004 03:15 AM



Advertisments