On Feb 26, 11:20 am, tyler kunter <tykun...@gmail.com> wrote:
> thanks eric...I was able to fgure that out after a lil frustration thank you
> for your response.
>
> On Thu, Feb 26, 2009 at 1:32 AM, Eric Abrahamsen <gir...@gmail.com> wrote:
>
> > On Feb 26, 2009, at 4:30 PM, tykun...@gmail.com wrote:
>
> > > Hi I am trying to pass an HTML table to a template and have it display
>
> > > Currently I have....{{table1}} inside my template to mark the position
> > > I wish to display the table
>
> > > In my views.py I have....return render_to_response('results_s.html',
> > > {'table1': table1})
>
> > > From this all I get back is the code for the HTML table inside my
> > > template rather than having the template recognize it as HTML
>
> > You're almost certainly getting autoescaped (
> >http://docs.djangoproject.com/en/dev/topics/templates/#id2
> > ). Try using {{ table1|safe }} in your template.
>
> > Yours,
> > Erc
>
> > > Any suggestions on how I can pass the table and display it inside a
> > > template.
>
> > > thanks
Seems to me that the view is certainly aware that the html in table1
is safe.  Rather than filtering table1, putting the onus on the
template writer to know this, the view could simply:

from django.utils.safestring import mark_safe
...
return render_to_response('results_s.html', {'table1': mark_safe
(table1)})

I guess it's a matter of taste.
Wayne
--~--~---------~--~----~------------~-------~--~----~
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