Daniel Roseman wrote:
> It's an intentional limitation of the template language that you can't
> do that. You'll need to write a custom tag or filter - luckily it can
> be done very trivially as a filter:
> 
> @register.filter
> def get_attr(obj, val)
>     return getattr(obj, val)
> 
> Now in the template:
> 
> {{ object|getattr:name }}

I agree that it doesn't belong in the template language, but it's 
surprising that there's no standard filter to do this...

Is there an open issue for this or should I raise one?

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
            - http://www.simplistix.co.uk

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to