Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #30716 > unrolled thread

How to print html in python the normal way

Started byashishjain.ash@gmail.com
First post2012-10-04 04:24 -0700
Last post2012-10-05 01:20 -0700
Articles 7 — 4 participants

Back to article view | Back to comp.lang.python


Contents

  How to print html in python the normal way ashishjain.ash@gmail.com - 2012-10-04 04:24 -0700
    Re: How to print html in python the normal way Chris Angelico <rosuav@gmail.com> - 2012-10-04 21:30 +1000
      Re: How to print html in python the normal way Ramchandra Apte <maniandram01@gmail.com> - 2012-10-04 06:11 -0700
        Re: How to print html in python the normal way Joel Goldstick <joel.goldstick@gmail.com> - 2012-10-04 09:19 -0400
      Re: How to print html in python the normal way Ramchandra Apte <maniandram01@gmail.com> - 2012-10-04 06:11 -0700
      Re: How to print html in python the normal way ashishjain.ash@gmail.com - 2012-10-05 01:20 -0700
      Re: How to print html in python the normal way ashishjain.ash@gmail.com - 2012-10-05 01:20 -0700

#30716 — How to print html in python the normal way

Fromashishjain.ash@gmail.com
Date2012-10-04 04:24 -0700
SubjectHow to print html in python the normal way
Message-ID<4d096ff3-e25f-400e-89c6-47483aaacc0d@googlegroups.com>
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

[toc] | [next] | [standalone]


#30717

FromChris Angelico <rosuav@gmail.com>
Date2012-10-04 21:30 +1000
Message-ID<mailman.1791.1349350257.27098.python-list@python.org>
In reply to#30716
On Thu, Oct 4, 2012 at 9:24 PM,  <ashishjain.ash@gmail.com> 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

[toc] | [prev] | [next] | [standalone]


#30720

FromRamchandra Apte <maniandram01@gmail.com>
Date2012-10-04 06:11 -0700
Message-ID<b198f16a-ff25-4a05-a680-d6adb07fdad9@googlegroups.com>
In reply to#30717
On Thursday, 4 October 2012 17:00:57 UTC+5:30, Chris Angelico  wrote:
> On Thu, Oct 4, 2012 at 9:24 PM,  <ashishjain.ash@gmail.com> 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

[toc] | [prev] | [next] | [standalone]


#30723

FromJoel Goldstick <joel.goldstick@gmail.com>
Date2012-10-04 09:19 -0400
Message-ID<mailman.1795.1349356778.27098.python-list@python.org>
In reply to#30720
On Thu, Oct 4, 2012 at 9:11 AM, Ramchandra Apte <maniandram01@gmail.com> wrote:
> On Thursday, 4 October 2012 17:00:57 UTC+5:30, Chris Angelico  wrote:
>> On Thu, Oct 4, 2012 at 9:24 PM,  <ashishjain.ash@gmail.com> 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/dev/topics/templates/#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

[toc] | [prev] | [next] | [standalone]


#30721

FromRamchandra Apte <maniandram01@gmail.com>
Date2012-10-04 06:11 -0700
Message-ID<mailman.1794.1349356325.27098.python-list@python.org>
In reply to#30717
On Thursday, 4 October 2012 17:00:57 UTC+5:30, Chris Angelico  wrote:
> On Thu, Oct 4, 2012 at 9:24 PM,  <ashishjain.ash@gmail.com> 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

[toc] | [prev] | [next] | [standalone]


#30789

Fromashishjain.ash@gmail.com
Date2012-10-05 01:20 -0700
Message-ID<744677a5-8f47-4b03-b15f-2b3db6f0642d@googlegroups.com>
In reply to#30717
Hi,

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

- Regards
Ashish

[toc] | [prev] | [next] | [standalone]


#30790

Fromashishjain.ash@gmail.com
Date2012-10-05 01:20 -0700
Message-ID<mailman.1844.1349425232.27098.python-list@python.org>
In reply to#30717
Hi,

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

- Regards
Ashish

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web