http://www.djangoproject.com/documentation/templates/#automatic-html-escaping
On Jun 25, 10:36 am, TigerHawk <[EMAIL PROTECTED]> wrote:
> Hello,
> This is my first post and I'm fairly new to Django/Python. I am having
> a little trouble getting a string converted to html.
>
> Here is my view code:
> def doPassageQuery(request):
> response_dict = {}
> options = {}
> options['include-short-copyright'] = 0
> options['include-footnotes'] = 0
> options['include-headings'] = 0
> options['include-subheadings'] = 0
> options['include-audio-link'] = 0
> options['passage'] = request.GET['passage']
> url_values = urllib.urlencode(options)
> baseUrl = 'http://www.esvapi.org/v2/rest/passageQuery?key=IP'
> url = baseUrl + '&%s' % (url_values)
> response = urllib2.urlopen(url)
> page = response.read()
> response_dict.update({'page': page})
> return render_to_response('passage/passage.html', response_dict)
>
> This retrieves a bible verse from the ESV Bible's api in html format
> but, the result is a string as far as Django is concerned so when I
> print it in the template all of the html tags are printed instead of
> being parsed.
>
> My question is how do I convert the string to valid html that will be
> parsed by the browser instead of displayed? As I already stated, I'm
> new to Django/Python and I haven't been able to find a way to do it.
>
> Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---