On 8/13/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote:
>
> On 7/31/06, Todd O'Bryan <[EMAIL PROTECTED]> wrote:
> > I would actually be okay writing the function in the view code, if we
> > had a map filter.
> >
> > {{ s.teachers|map:list_func|join:";" }}
> >
> > Then add the following to the context:
> >
> > "list_func": lambda(x): x.userinfo.informal_name()
> >
> > How hard would that be to implement, and is it potentially useful
> > enough that it'd be worth it?
>
> One problem with that is that template filters can't be objects at the
> moment -- they can only be strings. So if we were to do this (which I
> don't really have an opinion on yet), it would have to wait until the
> template system were improved to accept objects as well as strings, as
> filter arguments.
>
> Adrian
>
If we can use an alternative way to do that:
{% for t in s.teachers %}
{{ t.userinfo.informal_name }}{{ ";" if not forloop.last }}
{% endfor %}
Here I put "if" expression in template variable syntax. I don't know
whether it can be simpler.
--
I like python!
My Blog: http://www.donews.net/limodou
My Django Site: http://www.djangocn.org
NewEdit Maillist: http://groups.google.com/group/NewEdit
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---