I have a Journal model that has a OneToOneField linking to a Blurb
model (blurbs have title, text, author, etc.).  In a template i do the
following to get to the blurb attributes:

{{ entry.get_blurb.get_author.username }}
{{ entry.get_blurb.title }}
{{ entry.get_blurb.text }}
etc.

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?

Thanks!
-berto.

Reply via email to