class Foo:
def get_bars(self):
bars = []
# do something to collect bar instances
return bars
bars = property(get_bars)
in my template, I'd like to do something like this:
{% for bar in foo.bars %}
{{bar.snafu}}
{% endfor %}
But when I do that, I get "TemplateSyntaxError: 'property' object is
not iterable."
If I change it to {% for bar in foo.get_bars() %}, I get a
TemplateSyntaxError: could not parse the remainder"
If I change it to {% for bar in foo.get_bars %}, the template runs,
but it does not seem to be calling "get_bars"
How can I do what I'm trying to do? (Must I create a "regular" list
attribute and pre-populate it?)