The with tag worked. Thanks.
On Sep 12, 12:10 pm, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Sep 12, 8:08 pm, "W.P. McNeill" <bill...@gmail.com> wrote:
>
>
>
>
>
> > I have a view that renders a table. The "table" object is a list
> > rows, which are themselves lists of model objects. These objects have
> > a parameter called label.
>
> > Inside the template
>
> > {{ object.label }}
>
> > render's an objects label and
>
> > {{ row|first }}
>
> > renders the first object in the row.
>
> > I want to be able to render the label of the first object in the row.
> > I want to write something like this
>
> > {{ row|first.label }}
>
> > but that doesn't work. Is there equivalent syntax that does work
> > within the template markup language?
>
> You might be able to use the {% with %} tag to assign the first row to
> another variable, and use that. Untested:
>
> {% with row|first as first_row %}
> {{ first_row.label }}
> {% endwith %}
>
> Otherwise, you'll need a custom template tag - luckily these are very
> easy to write.
> --
> DR.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---