Thank you for the help. I'm going to test it when I get a chance. Now that you've said it, it should have been clear to me from the start.
On Feb 26, 11:38 am, Tom Evans <[email protected]> wrote: > On Fri, Feb 26, 2010 at 4:25 PM, HumanSimulator > > > > > > <[email protected]> wrote: > > I apologize if this has been discussed before but I did search and > > wasn't able to find what I'm looking for. > > > Anyways, I'm currently writing a very simplistic text adventure style > > game in Django and what I'm looking for is to store a template var in > > the database and then render it. > > > Like say I have > > > zone_text = "A shadowy figure comes up to you and says 'Hey > > {{ character.name }} I've been waiting for you" > > > If character.name is passed in through the context as "Hernan" I would > > obviously want it to show up as Hey Hernan I've been waiting for you. > > Instead it leaves it unevaluated though. > > > Is there already a way either in Django, or that someone has already > > coded that will re-parse the text and put out the correct sentence? I > > don't want to re-invent the wheel if it's already been done. > > > Thank you for your help. > > -Bob > > You will need to render it: > > from django.template import RequestContext, Template > zone_text = '...' > rendered_zone_text = > Template(zone_text).render(RequestContext(request, { 'foo': 'bar' }) > > Cheers > > Tom -- 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.

