On 1/29/06, Roberto Aguilar <[EMAIL PROTECTED]> wrote: > is there a way to say something like: > > {% set blurb entry.get_blurb %} > > and then just use: > > {{ blurb.get_author.username }} > {{ blurb.subject }} > {{ blurb.text }} > > It looks like having to use get_blurb every time is expensive since > the object is being retrieved multiple times (not to mention more > typing ;). Is setting variables inside templates against the way of > the template?
Hi Berto, Behind the scenes, get_blurb() only hits the database once. It caches the result for subsequent accesses. There's no way to set variables in the template language, but if you're wanting to save on typing, I'd recommend passing 'blurb' as a variable in your template's context. Adrian -- Adrian Holovaty holovaty.com | djangoproject.com | chicagocrime.org